Skip to content

Commit f8a8d38

Browse files
colinlyguojonastheisomerfirmakPéter GaramvölgyiThegaram
authored
feat: add set code tx support (#43)
* add initial CodecV6 and daBatchV6 * feat: add codecv5 and codecv6 for Euclid fork * implement blob encoding and decoding according to new blob layout * rename to CodecV7 * add NewDABatchFromParams * add DecodeBlob to Codec * Update da.go * Update interfaces.go * fixes after merge * address review comments * add sanity checks for blob payload generation * fix few small bugs uncovered by unit tests * upgrade to latest l2geth version and add correct getter for CodecV7 in CodecFromConfig * fix linter warnings * add unit tests * go mod tidy * fix linter warnings * add function MessageQueueV2ApplyL1MessagesFromBlocks to compute the L1 message hash from a given set of blocks * fix lint and unit test errors * call checkCompressedDataCompatibility only once -> constructBlobPayload only once * address review comments * update BlobEnvelopeV7 documentation * add CodecV7 to general util functions * add InitialL1MessageQueueHash and LastL1MessageQueueHash to encoding.Chunk * go mod tidy * upgrade go-ethereum dependency to latest develop * implement estimate functions * update TestMain and run go mod tidy * add NewDAChunk to CodecV7 for easier use in relayer * add daChunkV7 type to calculate chunk hash * allow batch.chunks but check consistency with batch.blocks * fix off-by-one error with L1 messages * Fix: rolling hash implementation (#42) * fix: clear 32 bits instead of 36 * fix: test expectations for rolling hash * fix: tests * fix tests --------- Co-authored-by: jonastheis <4181434+jonastheis@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com> * rename initialL1MessageQueueHash -> prevL1MessageQueueHash and lastL1MessageQueueHash -> postL1MessageQueueHash * address review comments * address review comments * add challenge digest computation for batch * remove InitialL1MessageIndex from CodecV7 * address review comments * fix tests * refactoring to minimize duplicate code and increase maintainability * fix nil pointer * feat: add setcode tx support * add AccessList and AuthList * go mod tidy * fix conflict fix bugs * update dependency --------- Co-authored-by: jonastheis <4181434+jonastheis@users.noreply.github.com> Co-authored-by: Ömer Faruk Irmak <omerfirmak@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@ip-192-168-0-18.us-west-2.compute.internal> Co-authored-by: Péter Garamvölgyi <peter@scroll.io> Co-authored-by: Rohit Narurkar <rohit.narurkar@proton.me>
1 parent 2ace506 commit f8a8d38

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

encoding/da.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"math/big"
1010
"slices"
1111

12+
"github.com/holiman/uint256"
1213
"github.com/klauspost/compress/zstd"
1314
"github.com/scroll-tech/go-ethereum/crypto"
1415

@@ -261,7 +262,24 @@ func convertTxDataToRLPEncoding(txData *types.TransactionData) ([]byte, error) {
261262
S: txData.S.ToInt(),
262263
})
263264

264-
default: // BlobTxType, SetCodeTxType, L1MessageTxType
265+
case types.SetCodeTxType:
266+
tx = types.NewTx(&types.SetCodeTx{
267+
ChainID: uint256.MustFromBig(txData.ChainId.ToInt()),
268+
Nonce: txData.Nonce,
269+
To: *txData.To,
270+
Value: uint256.MustFromBig(txData.Value.ToInt()),
271+
Gas: txData.Gas,
272+
GasTipCap: uint256.MustFromBig(txData.GasTipCap.ToInt()),
273+
GasFeeCap: uint256.MustFromBig(txData.GasFeeCap.ToInt()),
274+
Data: data,
275+
AccessList: txData.AccessList,
276+
AuthList: txData.AuthorizationList,
277+
V: uint256.MustFromBig(txData.V.ToInt()),
278+
R: uint256.MustFromBig(txData.R.ToInt()),
279+
S: uint256.MustFromBig(txData.S.ToInt()),
280+
})
281+
282+
default: // BlobTxType, L1MessageTxType
265283
return nil, fmt.Errorf("unsupported tx type: %d", txData.Type)
266284
}
267285

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
require (
66
github.com/agiledragon/gomonkey/v2 v2.12.0
7-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250206083728-ea43834c198f
7+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250225152658-bcfdb48dd939
88
github.com/stretchr/testify v1.9.0
99
)
1010

@@ -18,7 +18,7 @@ require (
1818
github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect
1919
github.com/go-ole/go-ole v1.3.0 // indirect
2020
github.com/go-stack/stack v1.8.1 // indirect
21-
github.com/holiman/uint256 v1.2.4 // indirect
21+
github.com/holiman/uint256 v1.2.4
2222
github.com/iden3/go-iden3-crypto v0.0.15 // indirect
2323
github.com/klauspost/compress v1.17.9
2424
github.com/kr/text v0.2.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
7878
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
7979
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
8080
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
81-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250206083728-ea43834c198f h1:WgIRuMWa7Q/xD1LHPEbQ9PpltasNiYR04qFzatiP/R0=
82-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250206083728-ea43834c198f/go.mod h1:Ik3OBLl7cJxPC+CFyCBYNXBPek4wpdzkWehn/y5qLM8=
81+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250225152658-bcfdb48dd939 h1:KODmYD4s4BY/SBheCHqGbATnGPLQKzTJVuAElA8Eh+0=
82+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250225152658-bcfdb48dd939/go.mod h1:AgU8JJxC7+nfs7R7ma35AU7dMAGW7wCw3dRZRefIKyQ=
8383
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
8484
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
8585
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=

0 commit comments

Comments
 (0)