Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a81ec23
debug: add timestamp progression and nil withdrawals for pre-shanghai
4rgon4ut Jun 15, 2023
70f219e
Merge branch 'feat/add-withdrawals-sync-test' of https://github.com/g…
stdevMac Jun 16, 2023
2a7355f
[debug] error on timestamp
stdevMac Jun 19, 2023
ea7a31c
[debug] adding new contract definition for withdrawals
stdevMac Jun 20, 2023
81bc889
[debug] claim not working on withdrawals
stdevMac Jun 23, 2023
b44ae0a
Merge branch 'feat/update-contract' into feat/merge-test-update
stdevMac Jun 23, 2023
1bdf8b7
debug: added contract to track coinbase access gascost
4rgon4ut Jun 28, 2023
335f64c
feat: add AllocGenesis logic for nethermind chainspec
4rgon4ut Jun 28, 2023
3bcf6a7
chore: separated payload transactions logic
4rgon4ut Jun 29, 2023
aac98c2
docs: add payload transactions function comments
4rgon4ut Jun 29, 2023
2335eb2
[debug] working withdrawals but crashing on nethermind node
stdevMac Jun 29, 2023
35d9400
fix: fixed contracts WARM_COINBASE && PUSH0 pre/post shapella checks
4rgon4ut Jun 29, 2023
83eeec4
docs: contracts bytecode explanations
4rgon4ut Jun 30, 2023
4f2e475
feat(helper:account): add getters
4rgon4ut Jun 30, 2023
a2cc347
chore: push0 name typo in docstring
4rgon4ut Jun 30, 2023
2e1960d
Merge pull request #2 from gnosischain/fix/warm-coinbase-and-push0-ch…
stdevMac Jun 30, 2023
795b5ca
Merge remote-tracking branch 'origin/feat/add-withdrawals-sync-test' …
stdevMac Jun 30, 2023
0dbe633
[debug] breaking nethermind node
stdevMac Jun 30, 2023
692f4f9
[feat] clean up base tests
stdevMac Jun 30, 2023
03ee2e4
chore(ethereum/engine): go work sync
4rgon4ut Jul 1, 2023
4a0d0fe
chore(simulators/ethereum): go work sync
4rgon4ut Jul 1, 2023
fa28838
chore(withdrawals): remove unused and commented code
4rgon4ut Jul 1, 2023
c43b752
chore(libgno): rename function && remove unused code
4rgon4ut Jul 1, 2023
c8c52d6
feat(helper): add interface compliance checks
4rgon4ut Jul 1, 2023
abd80e9
deps(engine): go mod vendor (requirement after go work sync)
4rgon4ut Jul 1, 2023
0ee53de
chore(helper): remove commented code
4rgon4ut Jul 2, 2023
5d2fcf6
chore(libgno): simplify declaration
4rgon4ut Jul 2, 2023
d7906ef
chore(helper): add interface compliance check
4rgon4ut Jul 2, 2023
910ea3d
fix(libgno): return accidently removed variable
4rgon4ut Jul 2, 2023
a57d8df
refactor(libgno): simplifications and comments
4rgon4ut Jul 3, 2023
c07b4de
chore: removed root lvl vendor
4rgon4ut Jul 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions simulators/ethereum/consensus/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
Expand All @@ -65,8 +63,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/ethereum/go-ethereum v1.11.4 h1:KG81SnUHXWk8LJB3mBcHg/E2yLvXoiPmRMCIRxgx3cE=
github.com/ethereum/go-ethereum v1.11.4/go.mod h1:it7x0DWnTDMfVFdXcU6Ti4KEFQynLHVRarcSlPr0HBo=
github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo2CXQ8E=
github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y=
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e h1:3g9cqRqpbZ92tSlGL4PfFoq435axKw6HiZ1Gz3fOkfk=
Expand Down Expand Up @@ -120,8 +116,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand All @@ -144,8 +140,6 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o=
github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk=
github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down Expand Up @@ -322,8 +316,6 @@ golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -358,7 +350,7 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -402,8 +394,6 @@ golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand All @@ -414,8 +404,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
6 changes: 4 additions & 2 deletions simulators/ethereum/engine/globals/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ var (
MaxTimeDriftSeconds = int64(60)

// This is the account that sends vault funding transactions.
VaultAccountAddress = common.HexToAddress("0x59f80ed315477f9f0059D862713A7b082A599217")
VaultKey, _ = crypto.HexToECDSA("ff804d09c833619af673fa99c92ae506d30ff60f37ad41a3d098dcf714db1e4a")
VaultAccountAddress = common.HexToAddress("0x59f80ed315477f9f0059D862713A7b082A599217")
VaultKey, _ = crypto.HexToECDSA("ff804d09c833619af673fa99c92ae506d30ff60f37ad41a3d098dcf714db1e4a")
GnoVaultAccountAddress = common.HexToAddress("0xcC4e00A72d871D6c328BcFE9025AD93d0a26dF51")
GnoVaultVaultKey, _ = crypto.HexToECDSA("82fcff5c93519f3615d6a92a5a7d146ee305082d3d768d63eb1b45f11f419346")

// Global test case timeout
DefaultTestCaseTimeout = time.Minute * 10
Expand Down
4 changes: 2 additions & 2 deletions simulators/ethereum/engine/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ go 1.18
require (
github.com/ethereum/go-ethereum v1.11.6
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e
github.com/ethereum/hive/simulators/ethereum/rpc v0.0.0-20230526161643-a5c0542ee4ac
github.com/golang-jwt/jwt/v4 v4.4.3
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/mailru/easyjson v0.7.7
github.com/pkg/errors v0.9.1
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
Expand All @@ -18,6 +17,7 @@ require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/cp v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
Expand Down
7 changes: 3 additions & 4 deletions simulators/ethereum/engine/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=
github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -79,8 +80,6 @@ github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo
github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y=
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e h1:3g9cqRqpbZ92tSlGL4PfFoq435axKw6HiZ1Gz3fOkfk=
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e/go.mod h1:PlpDuxHg6q1jU0K8Ouf+RXlHguignJ7k8Eyukc9RCPQ=
github.com/ethereum/hive/simulators/ethereum/rpc v0.0.0-20230526161643-a5c0542ee4ac h1:vXJyOdY/KftXDrg6f0TFtOJkP/LaTPMOGsbngYm0KK0=
github.com/ethereum/hive/simulators/ethereum/rpc v0.0.0-20230526161643-a5c0542ee4ac/go.mod h1:DyRd29AtsFbT/tBEB7/cE87X029pmEmNbhFfb/+9A/E=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ=
Expand Down Expand Up @@ -122,8 +121,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down
106 changes: 70 additions & 36 deletions simulators/ethereum/engine/helper/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ package helper
import (
"encoding/json"
"fmt"
"math/big"
"strconv"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"math/big"
"strconv"
)

var (
_ GenesisAccount = (Account)(nil)
// _ Genesis = (*NethermindChainSpec)(nil)
)

type GenesisAlloc interface {
Expand All @@ -19,12 +25,13 @@ type GenesisAlloc interface {
type GenesisAccount interface {
// Balance holds the balance of the account
Balance() *big.Int
SetBalance()
Code() []byte
SetBalance(balance *big.Int)
Code() string
SetCode(code []byte)
SetConstructor(constructor []byte)
Constructor() []byte
Constructor() string
}

type Genesis interface {
Config() *params.ChainConfig
SetConfig(config *params.ChainConfig)
Expand All @@ -43,11 +50,10 @@ type Genesis interface {
Coinbase() common.Address
SetCoinbase(address common.Address)
Alloc() GenesisAlloc
AllocGenesis(address common.Address, account GenesisAccount)
AllocGenesis(address common.Address, account Account)
UpdateTimestamp(timestamp string)

// Used for testing

Number() uint64
GasUsed() uint64
ParentHash() common.Hash
Expand All @@ -56,29 +62,65 @@ type Genesis interface {
ToBlock() *types.Block

// Marshalling and Unmarshalling interfaces

json.Unmarshaler
json.Marshaler
}

//type PricingStruct struct {
// Price map[string]map[string]uint64 `json:"price,omitempty"`
//}

//type Pricing map[string]PricingStruct

type Builtin struct {
Name string `json:"name,omitempty"`
Pricing map[string]interface{} `json:"pricing,omitempty"`
}

type Account map[string]interface{}

//struct {
// Balance string `json:"balance,omitempty"`
// Constructor string `json:"constructor,omitempty"`
// Builtin Builtin `json:"builtin,omitempty"`
//}
func NewAccount() Account {
return make(Account, 0)
}

// GetCode returns theaccount balance if it was set,
// otherwise returns common.Big0
func (a Account) Balance() *big.Int {
hexBalance, ok := a["balance"]
if !ok {
return common.Big0
}
hexStr := hexBalance.(string)
balance := common.Big0
_ = balance.FillBytes(common.Hex2Bytes(hexStr))
return balance
}

func (a Account) SetBalance(balance *big.Int) {
a["balance"] = common.BigToHash(balance)
}

// GetCode returns the hex representation of code if it was set,
// otherwise returns ""
func (a Account) Code() string {
code, ok := a["code"]
if !ok {
return ""
}
return fmt.Sprintf("%x", code.(string))
}

func (a Account) SetCode(code []byte) {
a["code"] = common.Bytes2Hex(code)
}

// GetConstructor returns the hex representation of constructor if it was set,
// otherwise returns ""
func (a Account) Constructor() string {
constructor, ok := a["constructor"]
if !ok {
return ""
}
return fmt.Sprintf("%x", constructor.(string))
}

func (a Account) SetConstructor(constructor []byte) {
a["constructor"] = common.Bytes2Hex(constructor)
}

type NethermindGenesis struct {
Seal struct {
Expand Down Expand Up @@ -175,11 +217,16 @@ func (n *NethermindChainSpec) Config() *params.ChainConfig {
if err != nil {
panic(err)
}
shangai := big.NewInt(0).SetBytes(common.Hex2Bytes(n.Params.Eip4895TransitionTimestamp)).Uint64()
unixTimestampUint64, err := strconv.ParseUint(n.Params.Eip4895TransitionTimestamp[2:], 16, 64)
if err != nil {
fmt.Println("Error parsing hexadecimal timestamp:", err)
return nil
}

return &params.ChainConfig{
ChainID: chainID,
TerminalTotalDifficulty: big.NewInt(ttd),
ShanghaiTime: &shangai,
ShanghaiTime: &unixTimestampUint64,
}
}

Expand Down Expand Up @@ -260,9 +307,8 @@ func (n *NethermindChainSpec) Alloc() GenesisAlloc {
panic("implement me")
}

func (n *NethermindChainSpec) AllocGenesis(address common.Address, account GenesisAccount) {
//TODO implement me
panic("implement me")
func (n *NethermindChainSpec) AllocGenesis(address common.Address, account Account) {
n.Accounts[address.Hex()] = account
}

func (n *NethermindChainSpec) Number() uint64 {
Expand All @@ -289,15 +335,3 @@ func (n *NethermindChainSpec) ToBlock() *types.Block {
//TODO implement me
panic("implement me")
}

//func (n *NethermindChainSpec) UnmarshalJSON(bytes []byte) error {
// return json.Unmarshal(bytes, &n)
//}
//
//func (n *NethermindChainSpec) MarshalJSON() ([]byte, error) {
// bytes, err := json.Marshal(n)
// if err != nil {
// return nil, err
// }
// return bytes, nil
//}
38 changes: 28 additions & 10 deletions simulators/ethereum/engine/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,6 @@ func LoadGenesisTest(path string) string {
if err != nil {
panic(fmt.Errorf("can't to read genesis file: %v", err))
}

//var genesis NethermindChainSpec
//err = genesis.UnmarshalJSON(contents)
//if err != nil {
// return nil
//}
//if err := json.Unmarshal(contents, &genesis); err != nil {
// panic(fmt.Errorf("can't parse genesis JSON: %v", err))
//}
//return Genesis(&genesis)
return string(contents)
}

Expand Down Expand Up @@ -397,6 +387,8 @@ const (
DynamicFeeTxOnly
)

var _ TransactionCreator = (*BaseTransactionCreator)(nil)

type TransactionCreator interface {
MakeTransaction(nonce uint64) (*types.Transaction, error)
}
Expand Down Expand Up @@ -566,6 +558,32 @@ func SendNextTransaction(testCtx context.Context, node client.EngineClient, txCr
}
}

func SendNextTransactionWithAccount(testCtx context.Context, node client.EngineClient, txCreator TransactionCreator, sender common.Address) (*types.Transaction, error) {
nonce, err := node.GetNextAccountNonce(testCtx, sender)
if err != nil {
return nil, err
}
tx, err := txCreator.MakeTransaction(nonce)
if err != nil {
return nil, err
}
for {
ctx, cancel := context.WithTimeout(testCtx, globals.RPCTimeout)
defer cancel()
err := node.SendTransaction(ctx, tx)
if err == nil {
return tx, nil
} else if SentTxAlreadyKnown(err) {
return tx, nil
}
select {
case <-time.After(time.Second):
case <-testCtx.Done():
return nil, testCtx.Err()
}
}
}

func SendNextTransactions(testCtx context.Context, node client.EngineClient, txCreator TransactionCreator, txCount uint64) ([]*types.Transaction, error) {
var err error
nonce, err := node.GetNextAccountNonce(testCtx, globals.VaultAccountAddress)
Expand Down
Loading