Skip to content

Commit 2f6a17b

Browse files
committed
Merge branch 'taiko' into moonchain-geneva
# Conflicts: # .github/workflows/docker.yml
2 parents a2867a6 + fdd905a commit 2f6a17b

File tree

11 files changed

+168
-66
lines changed

11 files changed

+168
-66
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
runs-on: arc-runner-set
1212
steps:
1313
- name: Cancel Previous Runs
1414
uses: styfle/cancel-workflow-action@0.11.0
1515
with:
1616
access_token: ${{ github.token }}
1717

18+
- name: Prepare environment
19+
continue-on-error: true
20+
run: sudo apt-get update && sudo apt-get install -y build-essential
21+
1822
- uses: actions/checkout@v3
1923
with:
2024
repository: taikoxyz/taiko-geth

.github/workflows/close-inactive-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
close-issues:
8-
runs-on: ubuntu-latest
8+
runs-on: arc-runner-set
99
permissions:
1010
issues: write
1111
pull-requests: write

.github/workflows/docker.yml

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,55 @@
1-
name: "Push docker image to GAR"
1+
name: "Push multi-arch docker image to GAR"
22

33
on:
44
push:
55
branches: [ moonchain-geneva ]
66
tags:
77
- "v*"
88

9+
env:
10+
REGISTRY_IMAGE: us-docker.pkg.dev/mxczkevm/images/moonchain-geth
11+
912
jobs:
10-
push-docker-image:
11-
runs-on: ubuntu-latest
13+
build:
14+
name: Build and push docker image
15+
strategy:
16+
matrix:
17+
include:
18+
- runner: arc-runner-set
19+
platform: linux/amd64
20+
- runner: arc-runner-set-arm64
21+
platform: linux/arm64
22+
23+
runs-on: ${{ matrix.runner }}
1224

1325
steps:
26+
- name: Prepare Environment
27+
run: |
28+
platform=${{ matrix.platform }}
29+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
30+
sudo apt-get update && sudo apt-get install -y git
31+
1432
- name: Checkout
15-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
1634

1735
- name: Login to GAR
18-
uses: docker/login-action@v2
36+
uses: docker/login-action@v3
1937
with:
2038
registry: us-docker.pkg.dev
2139
username: _json_key
22-
password: ${{ secrets.GCR_JSON_KEY }}
40+
password: ${{ secrets.GAR_JSON_KEY }}
2341

2442
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v1
43+
uses: docker/setup-qemu-action@v3
2644

2745
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v1
46+
uses: docker/setup-buildx-action@v3
2947

3048
- name: Docker meta
3149
id: meta
32-
uses: docker/metadata-action@v4
50+
uses: docker/metadata-action@v5
3351
with:
34-
images: |
35-
us-docker.pkg.dev/mxczkevm/images/moonchain-geth
52+
images: ${{ env.REGISTRY_IMAGE }}
3653
tags: |
3754
type=ref,event=branch
3855
type=ref,event=pr
@@ -57,13 +74,76 @@ jobs:
5774
}
5875
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
5976

60-
- name: Build and push
61-
uses: docker/build-push-action@v2
77+
- name: Build and push by digest
78+
id: build
79+
uses: docker/build-push-action@v5
6280
with:
6381
context: .
6482
cache-from: type=gha
6583
cache-to: type=gha,mode=max
66-
platforms: linux/amd64,linux/arm64
84+
platforms: ${{ matrix.platform }}
6785
push: true
68-
tags: ${{ steps.meta.outputs.tags }}
86+
tags: ${{ env.REGISTRY_IMAGE }}
6987
labels: ${{ steps.meta.outputs.labels }}
88+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
89+
90+
91+
- name: Export digest
92+
run: |
93+
mkdir -p /tmp/digests
94+
digest="${{ steps.build.outputs.digest }}"
95+
touch "/tmp/digests/${digest#sha256:}"
96+
97+
- name: Upload digest
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: digests-${{ env.PLATFORM_PAIR }}
101+
path: /tmp/digests/*
102+
if-no-files-found: error
103+
retention-days: 1
104+
105+
merge:
106+
runs-on: arc-runner-set
107+
needs:
108+
- build
109+
steps:
110+
- name: Prepare Environment
111+
run: sudo apt-get update && sudo apt-get install -y jq
112+
113+
- name: Download digests
114+
uses: actions/download-artifact@v4
115+
with:
116+
path: /tmp/digests
117+
pattern: digests-*
118+
merge-multiple: true
119+
120+
- name: Set up Docker Buildx
121+
uses: docker/setup-buildx-action@v3
122+
123+
- name: Docker meta
124+
id: meta
125+
uses: docker/metadata-action@v5
126+
with:
127+
images: ${{ env.REGISTRY_IMAGE }}
128+
tags: |
129+
type=ref,event=branch
130+
type=ref,event=pr
131+
type=ref,event=tag
132+
type=sha
133+
134+
- name: Login to GAR
135+
uses: docker/login-action@v3
136+
with:
137+
registry: us-docker.pkg.dev
138+
username: _json_key
139+
password: ${{ secrets.GAR_JSON_KEY }}
140+
141+
- name: Create manifest list and push
142+
working-directory: /tmp/digests
143+
run: |
144+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
145+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
146+
147+
- name: Inspect image
148+
run: |
149+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

.github/workflows/lint-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
main:
99
name: Validate PR title
10-
runs-on: ubuntu-latest
10+
runs-on: arc-runner-set
1111
steps:
1212
- uses: amannn/action-semantic-pull-request@v5
1313
env:

.github/workflows/release-please.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
release-please:
14-
runs-on: ubuntu-latest
14+
runs-on: arc-runner-set
1515
steps:
1616
- uses: googleapis/release-please-action@v4
1717
with:

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [1.11.1](https://github.com/taikoxyz/taiko-geth/compare/v1.11.0...v1.11.1) (2024-10-22)
4+
5+
6+
### Bug Fixes
7+
8+
* **taiko-geth:** fix a mempool fetch issue ([#333](https://github.com/taikoxyz/taiko-geth/issues/333)) ([1340ded](https://github.com/taikoxyz/taiko-geth/commit/1340ded3811193b46d18241e5810c5b47083821f))
9+
* **taiko-geth:** revert a `tx.Shift()` change ([#335](https://github.com/taikoxyz/taiko-geth/issues/335)) ([46576d2](https://github.com/taikoxyz/taiko-geth/commit/46576d27209194db9e02ba38b9ab6b919679fcbd))
10+
* **taiko-geth:** stop using `RevertToSnapshot` when fetching mempool ([#336](https://github.com/taikoxyz/taiko-geth/issues/336)) ([1216d8d](https://github.com/taikoxyz/taiko-geth/commit/1216d8d6051ba6f73ee42b395e973dccf1d90cf9))
11+
12+
## [1.11.0](https://github.com/taikoxyz/taiko-geth/compare/v1.10.0...v1.11.0) (2024-10-16)
13+
14+
15+
### Features
16+
17+
* **core:** update `MainnetOntakeBlock` ([#330](https://github.com/taikoxyz/taiko-geth/issues/330)) ([cd72c5b](https://github.com/taikoxyz/taiko-geth/commit/cd72c5bf056cce5870b685226ae70e0d2620dc5e))
18+
319
## [1.10.0](https://github.com/taikoxyz/taiko-geth/compare/v1.9.0...v1.10.0) (2024-10-03)
420

521

core/state/statedb.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,6 @@ func (s *StateDB) Copy() *StateDB {
702702
return state
703703
}
704704

705-
// CHANGE(taiko): RevisionId returns the latest snapshot id.
706-
func (s *StateDB) RevisionId() int {
707-
return s.journal.nextRevisionId
708-
}
709-
710705
// Snapshot returns an identifier for the current revision of the state.
711706
func (s *StateDB) Snapshot() int {
712707
return s.journal.snapshot()

core/taiko_genesis.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import (
1010
)
1111

1212
var (
13-
InternalDevnetOntakeBlock = new(big.Int).SetUint64(2)
13+
InternalDevnetOntakeBlock = new(big.Int).SetUint64(0)
1414
HeklaOntakeBlock = new(big.Int).SetUint64(840_512)
15-
// TODO: update this value when mainnet fork height is decided
16-
MainnetOntakeBlock = new(big.Int).SetUint64(9_000_000)
15+
MainnetOntakeBlock = new(big.Int).SetUint64(538_304)
1716
)
1817

1918
// TaikoGenesisBlock returns the Taiko network genesis block configs.

core/taiko_genesis/internal_l2a.json

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

miner/taiko_worker.go

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"compress/zlib"
66
"errors"
77
"fmt"
8+
"maps"
89
"math/big"
910
"time"
1011

@@ -17,8 +18,8 @@ import (
1718
"github.com/ethereum/go-ethereum/log"
1819
"github.com/ethereum/go-ethereum/params"
1920
"github.com/ethereum/go-ethereum/rlp"
21+
2022
"github.com/holiman/uint256"
21-
"golang.org/x/exp/maps"
2223
)
2324

2425
// BuildTransactionsLists builds multiple transactions lists which satisfy all the given conditions
@@ -71,14 +72,15 @@ func (w *Miner) buildTransactionsLists(
7172
localTxs, remoteTxs = w.getPendingTxs(localAccounts, baseFee)
7273
)
7374

74-
commitTxs := func() (*PreBuiltTxList, error) {
75+
commitTxs := func(firstTransaction *types.Transaction) (*types.Transaction, *PreBuiltTxList, error) {
7576
env.tcount = 0
7677
env.txs = []*types.Transaction{}
7778
env.gasPool = new(core.GasPool).AddGas(blockMaxGasLimit)
7879
env.header.GasLimit = blockMaxGasLimit
7980

80-
w.commitL2Transactions(
81+
lastTransaction := w.commitL2Transactions(
8182
env,
83+
firstTransaction,
8284
newTransactionsByPriceAndNonce(signer, maps.Clone(localTxs), baseFee),
8385
newTransactionsByPriceAndNonce(signer, maps.Clone(remoteTxs), baseFee),
8486
maxBytesPerTxList,
@@ -87,19 +89,22 @@ func (w *Miner) buildTransactionsLists(
8789

8890
b, err := encodeAndCompressTxList(env.txs)
8991
if err != nil {
90-
return nil, err
92+
return nil, nil, err
9193
}
9294

93-
return &PreBuiltTxList{
95+
return lastTransaction, &PreBuiltTxList{
9496
TxList: env.txs,
9597
EstimatedGasUsed: env.header.GasLimit - env.gasPool.Gas(),
9698
BytesLength: uint64(len(b)),
9799
}, nil
98100
}
99101

102+
var (
103+
lastTx *types.Transaction
104+
res *PreBuiltTxList
105+
)
100106
for i := 0; i < int(maxTransactionsLists); i++ {
101-
res, err := commitTxs()
102-
if err != nil {
107+
if lastTx, res, err = commitTxs(lastTx); err != nil {
103108
return nil, err
104109
}
105110

@@ -227,16 +232,22 @@ func (w *Miner) getPendingTxs(localAccounts []string, baseFee *big.Int) (
227232
// commitL2Transactions tries to commit the transactions into the given state.
228233
func (w *Miner) commitL2Transactions(
229234
env *environment,
235+
firstTransaction *types.Transaction,
230236
txsLocal *transactionsByPriceAndNonce,
231237
txsRemote *transactionsByPriceAndNonce,
232238
maxBytesPerTxList uint64,
233239
minTip uint64,
234-
) {
240+
) *types.Transaction {
235241
var (
236-
txs = txsLocal
237-
isLocal = true
242+
txs = txsLocal
243+
isLocal = true
244+
lastTransaction *types.Transaction
238245
)
239246

247+
if firstTransaction != nil {
248+
env.txs = append(env.txs, firstTransaction)
249+
}
250+
240251
loop:
241252
for {
242253
// If we don't have enough gas for any further transactions then we're done.
@@ -284,8 +295,6 @@ loop:
284295
// Start executing the transaction
285296
env.state.SetTxContext(tx.Hash(), env.tcount)
286297

287-
snap := env.state.RevisionId()
288-
gasPool := env.gasPool.Gas()
289298
err := w.commitTransaction(env, tx)
290299
switch {
291300
case errors.Is(err, core.ErrNonceTooLow):
@@ -295,7 +304,6 @@ loop:
295304

296305
case errors.Is(err, nil):
297306
// Everything ok, collect the logs and shift in the next transaction from the same account
298-
env.tcount++
299307
txs.Shift()
300308

301309
data, err := rlp.EncodeToBytes(env.txs)
@@ -304,7 +312,6 @@ loop:
304312
txs.Pop()
305313
continue
306314
}
307-
308315
if len(data) >= int(maxBytesPerTxList) {
309316
// Encode and compress the txList, if the byte length is > maxBytesPerTxList, remove the latest tx and break.
310317
b, err := compress(data)
@@ -314,9 +321,8 @@ loop:
314321
continue
315322
}
316323
if len(b) > int(maxBytesPerTxList) {
324+
lastTransaction = env.txs[env.tcount-1]
317325
env.txs = env.txs[0 : env.tcount-1]
318-
env.state.RevertToSnapshot(snap)
319-
env.gasPool.SetGas(gasPool)
320326
break loop
321327
}
322328
}
@@ -328,6 +334,8 @@ loop:
328334
txs.Pop()
329335
}
330336
}
337+
338+
return lastTransaction
331339
}
332340

333341
// encodeAndCompressTxList encodes and compresses the given transactions list.

miner/taiko_worker_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ func testGenerateWorker(t *testing.T, txCount int) *Miner {
5454
}
5555

5656
func TestBuildTransactionsLists(t *testing.T) {
57-
w := testGenerateWorker(t, 1000)
57+
w := testGenerateWorker(t, 2000)
5858

5959
maxBytesPerTxList := (params.BlobTxBytesPerFieldElement - 1) * params.BlobTxFieldElementsPerBlob
6060
txList, err := w.BuildTransactionsLists(
6161
testBankAddress,
6262
nil,
6363
240_000_000,
64-
uint64(maxBytesPerTxList),
64+
uint64(maxBytesPerTxList)/10,
6565
nil,
6666
1,
6767
)

0 commit comments

Comments
 (0)