bsc/tests/gen_stlog.go
Felix Lange 225de7ca0a tests: update tests and implement general state tests (#14734)
Tests are now included as a submodule. This should make updating easier
and removes ~60MB of JSON data from the working copy.

State tests are replaced by General State Tests, which run the same test
with multiple fork configurations.

With the new test runner, consensus tests are run as subtests by walking
json files. Many hex issues have been fixed upstream since the last
update and most custom parsing code is replaced by existing JSON hex
types. Tests can now be marked as 'expected failures', ensuring that
fixes for those tests will trigger an update to test configuration. The
new test runner also supports parallel execution and the -short flag.
2017-07-11 13:49:14 +02:00

62 lines
1.5 KiB
Go

// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package tests
import (
"encoding/json"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*stLogMarshaling)(nil)
func (s stLog) MarshalJSON() ([]byte, error) {
type stLog struct {
Address common.UnprefixedAddress `json:"address"`
Data hexutil.Bytes `json:"data"`
Topics []common.UnprefixedHash `json:"topics"`
Bloom string `json:"bloom"`
}
var enc stLog
enc.Address = common.UnprefixedAddress(s.Address)
enc.Data = s.Data
if s.Topics != nil {
enc.Topics = make([]common.UnprefixedHash, len(s.Topics))
for k, v := range s.Topics {
enc.Topics[k] = common.UnprefixedHash(v)
}
}
enc.Bloom = s.Bloom
return json.Marshal(&enc)
}
func (s *stLog) UnmarshalJSON(input []byte) error {
type stLog struct {
Address *common.UnprefixedAddress `json:"address"`
Data hexutil.Bytes `json:"data"`
Topics []common.UnprefixedHash `json:"topics"`
Bloom *string `json:"bloom"`
}
var dec stLog
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Address != nil {
s.Address = common.Address(*dec.Address)
}
if dec.Data != nil {
s.Data = dec.Data
}
if dec.Topics != nil {
s.Topics = make([]common.Hash, len(dec.Topics))
for k, v := range dec.Topics {
s.Topics[k] = common.Hash(v)
}
}
if dec.Bloom != nil {
s.Bloom = *dec.Bloom
}
return nil
}