Skip to content
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
eb8c0a0
sae: Add C-chain custom tx serialization
StephenButtolph Apr 25, 2026
e248997
sae: Implement AsOp
StephenButtolph Apr 25, 2026
253c255
wip
StephenButtolph Apr 25, 2026
3cca8aa
comments
StephenButtolph Apr 25, 2026
6346d2e
reduce exported identifiers
StephenButtolph Apr 25, 2026
ab83fe6
wip
StephenButtolph Apr 26, 2026
8f3f888
wip
StephenButtolph Apr 26, 2026
83cc38b
wip
StephenButtolph Apr 26, 2026
d606762
Extend fuzz tests
StephenButtolph Apr 26, 2026
0a82734
nit
StephenButtolph Apr 26, 2026
5b86b6b
wip
StephenButtolph Apr 26, 2026
3d92bd5
wip
StephenButtolph Apr 26, 2026
893e17e
wip
StephenButtolph Apr 26, 2026
83b0ec0
wip
StephenButtolph Apr 26, 2026
c46bcc2
nit
StephenButtolph Apr 26, 2026
e92638f
nit
StephenButtolph Apr 26, 2026
f2faffb
lint
StephenButtolph Apr 26, 2026
7447b08
lint
StephenButtolph Apr 26, 2026
8c3b6f0
nits
StephenButtolph Apr 27, 2026
0369966
fix bazel
StephenButtolph Apr 28, 2026
85ae854
ci: free runner disk before publishing Antithesis images (#5310)
JonathanOppenheimer Apr 28, 2026
88a234a
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 28, 2026
4e261c6
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 28, 2026
7073c57
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 28, 2026
d63857d
merged
StephenButtolph Apr 28, 2026
06d2a41
nit
StephenButtolph Apr 28, 2026
c28b2d2
fuzz full op
StephenButtolph Apr 28, 2026
aba7590
mark as compatibility
StephenButtolph Apr 28, 2026
ca2a5ea
nit
StephenButtolph Apr 28, 2026
4be05cf
nit
StephenButtolph Apr 28, 2026
e721e6c
wip
StephenButtolph Apr 28, 2026
9b4c83f
nit
StephenButtolph Apr 28, 2026
5d9dd0d
merged
StephenButtolph Apr 28, 2026
2929163
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 28, 2026
af11c7e
sae: Implement AtomicRequests on custom txs
StephenButtolph Apr 28, 2026
c583599
lint + bazel
StephenButtolph Apr 28, 2026
2ffbf74
fix flake
StephenButtolph Apr 28, 2026
093fbdc
nit
StephenButtolph Apr 28, 2026
7e58c8e
nit
StephenButtolph Apr 28, 2026
ae780ec
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 28, 2026
8573565
nit
StephenButtolph Apr 28, 2026
2d50a62
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 28, 2026
2f01ee8
Unblock myself for sae progress
StephenButtolph Apr 29, 2026
b28d132
sae: Smarter tx fuzzing
StephenButtolph Apr 29, 2026
f12a1b4
nit
StephenButtolph Apr 29, 2026
258df6f
nit
StephenButtolph Apr 29, 2026
8cefe95
nit
StephenButtolph Apr 29, 2026
fa25c9a
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 29, 2026
95e7256
nit
StephenButtolph Apr 29, 2026
5d2ef23
want got
StephenButtolph Apr 29, 2026
46814f4
want got
StephenButtolph Apr 29, 2026
58306f5
Merge branch 'StephenButtolph/atomic-tx-rewrite.1' of github.com:ava-…
StephenButtolph Apr 29, 2026
88c09d1
merged
StephenButtolph Apr 29, 2026
271658d
nit
StephenButtolph Apr 29, 2026
9da6af8
nit
StephenButtolph Apr 29, 2026
7bcb962
ci
StephenButtolph Apr 29, 2026
34b1457
nosec
StephenButtolph Apr 29, 2026
692f899
merged
StephenButtolph Apr 29, 2026
eedd62e
nit
StephenButtolph Apr 29, 2026
e1ece39
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
9e3bb98
ci
StephenButtolph Apr 29, 2026
1220398
merged
StephenButtolph Apr 29, 2026
a4bad9b
remove duplicate code
StephenButtolph Apr 29, 2026
56850ce
nit
StephenButtolph Apr 29, 2026
a41e9a6
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
22ebf97
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 29, 2026
c74091e
nit
StephenButtolph Apr 29, 2026
cefd09f
nit
StephenButtolph Apr 29, 2026
2ed8fcb
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
bd9366e
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 29, 2026
05ddba9
oops
StephenButtolph Apr 29, 2026
192a266
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
3fd9a97
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 29, 2026
fca7808
no moar recursion pls
StephenButtolph Apr 29, 2026
f47cf40
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
5bdb2df
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 29, 2026
1ede276
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 29, 2026
01cc4cf
Merge branch 'StephenButtolph/atomic-tx-rewrite.1' into StephenButtol…
StephenButtolph Apr 29, 2026
bc6aed5
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 29, 2026
666066d
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 29, 2026
0de4a41
nit
StephenButtolph Apr 29, 2026
87d29d2
nit
StephenButtolph Apr 29, 2026
8535be8
nit
StephenButtolph Apr 29, 2026
6e9545c
Use the identifier rather than where the identifier is used
StephenButtolph Apr 30, 2026
47fe30d
Update visability
StephenButtolph Apr 30, 2026
adeaa57
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 30, 2026
6350008
merged
StephenButtolph Apr 30, 2026
05bb2f4
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
ba1afe1
nit
StephenButtolph Apr 30, 2026
166a9c2
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
e9487dc
merged
StephenButtolph Apr 30, 2026
3e3e6aa
ci
StephenButtolph Apr 30, 2026
9ffcd6c
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
980daa5
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
963c295
remove jank, use cmp
StephenButtolph Apr 30, 2026
937c6f8
merged
StephenButtolph Apr 30, 2026
8ae1a82
fix
StephenButtolph Apr 30, 2026
3d11e3b
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
d39ed4d
nit
StephenButtolph Apr 30, 2026
18c3c2b
merged
StephenButtolph Apr 30, 2026
ce459c0
merged
StephenButtolph Apr 30, 2026
05930e4
missed one
StephenButtolph Apr 30, 2026
9e0ffe5
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
7f3d20d
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
99f52e1
nit
StephenButtolph Apr 30, 2026
18a656e
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
63fb810
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
8bb04f6
bazel
StephenButtolph Apr 30, 2026
e6a1d35
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
28419a7
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
149b1cb
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.1
StephenButtolph Apr 30, 2026
a781d21
Merge branch 'StephenButtolph/atomic-tx-rewrite.1' into StephenButtol…
StephenButtolph Apr 30, 2026
23b9916
Add comment
StephenButtolph Apr 30, 2026
c1b9fa8
nit
StephenButtolph Apr 30, 2026
b4d98b5
nit
StephenButtolph Apr 30, 2026
81c3c02
nit
StephenButtolph Apr 30, 2026
9e36643
nit
StephenButtolph Apr 30, 2026
61dcfbd
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
ca7c26b
merged
StephenButtolph Apr 30, 2026
268f6ed
Merge branch 'StephenButtolph/smart-atomic-tx-fuzzing' into StephenBu…
StephenButtolph Apr 30, 2026
5334079
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
40c3ba6
cleanup
StephenButtolph Apr 30, 2026
3ed6547
cleanup
StephenButtolph Apr 30, 2026
f0515ec
Add more cases
StephenButtolph Apr 30, 2026
6dbe653
add comments
StephenButtolph Apr 30, 2026
9ae76cc
Add interface check
StephenButtolph Apr 30, 2026
6838983
nit
StephenButtolph Apr 30, 2026
4e67fcf
merged
StephenButtolph Apr 30, 2026
d44b9e6
grammar
StephenButtolph Apr 30, 2026
c5df5ae
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
900d328
nit
StephenButtolph Apr 30, 2026
bcc4037
nit
StephenButtolph Apr 30, 2026
5370371
more succinct
StephenButtolph Apr 30, 2026
7eb1978
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
b9c18ef
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
21cdd76
Merge branch 'StephenButtolph/atomic-tx-rewrite.3' of github.com:ava-…
StephenButtolph Apr 30, 2026
cfd18da
merged
StephenButtolph Apr 30, 2026
b555a85
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph Apr 30, 2026
a5c21d1
pedantic
StephenButtolph Apr 30, 2026
eb701ee
ok
StephenButtolph Apr 30, 2026
1ad0654
Document codec weirdness
StephenButtolph Apr 30, 2026
f37215f
nit
StephenButtolph May 1, 2026
ac82445
simplify
StephenButtolph May 2, 2026
cab3300
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.2
StephenButtolph May 2, 2026
8fe92a5
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph May 2, 2026
3f7b7c6
Merge branch 'master' into StephenButtolph/atomic-tx-rewrite.2
StephenButtolph May 2, 2026
efca198
Merge branch 'StephenButtolph/atomic-tx-rewrite.2' into StephenButtol…
StephenButtolph May 2, 2026
51a986d
reduce diff
StephenButtolph May 2, 2026
86b2b6e
oops
StephenButtolph May 2, 2026
904a654
nit
StephenButtolph May 2, 2026
a24de25
nit
StephenButtolph May 2, 2026
66ed39e
nit expand test
StephenButtolph May 4, 2026
fcc28ad
reduce diff
StephenButtolph May 4, 2026
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
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/Q
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
Expand Down Expand Up @@ -719,6 +720,7 @@ github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWe
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
Expand Down
2 changes: 2 additions & 0 deletions vms/saevm/cchain/tx/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go_library(
],
importpath = "github.com/ava-labs/avalanchego/vms/saevm/cchain/tx",
deps = [
"//chains/atomic",
"//codec",
"//codec/linearcodec",
"//graft/coreth/plugin/evm/atomic",
Expand All @@ -42,6 +43,7 @@ go_test(
data = glob(["testdata/**"]),
embed = [":tx"],
deps = [
"//chains/atomic",
"//graft/coreth/plugin/evm/atomic",
"//graft/coreth/plugin/evm/atomic/vm",
"//ids",
Expand Down
13 changes: 13 additions & 0 deletions vms/saevm/cchain/tx/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,16 @@
func (s *asOpStateDB) GetNonce(addr common.Address) uint64 {
return s.initialNonces[addr]
}

func FuzzAtomicRequestsCompatibility(f *testing.F) {
fuzz(f, func(t *testing.T, newTx *Tx) {
oldTx := ToOldTx(t, newTx)
wantChainID, wantRequests, err := oldTx.UnsignedAtomicTx.AtomicOps()
require.NoErrorf(t, err, "%T.AtomicOps()", oldTx.UnsignedAtomicTx)

gotChainID, gotRequests, err := newTx.AtomicRequests()
require.NoErrorf(t, err, "%T.AtomicRequests()", newTx)
assert.Equal(t, wantChainID, gotChainID, "chainID")

Check warning on line 164 in vms/saevm/cchain/tx/compatibility_test.go

View workflow job for this annotation

GitHub Actions / Lint

`assert.Equal`" continues on failure; consider require for fail-fast
assert.Equal(t, wantRequests, gotRequests, "requests")

Check warning on line 165 in vms/saevm/cchain/tx/compatibility_test.go

View workflow job for this annotation

GitHub Actions / Lint

`assert.Equal`" continues on failure; consider require for fail-fast
})
}
32 changes: 32 additions & 0 deletions vms/saevm/cchain/tx/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/ava-labs/avalanchego/utils/math"
"github.com/ava-labs/avalanchego/vms/components/avax"
"github.com/ava-labs/avalanchego/vms/saevm/hook"

chainsatomic "github.com/ava-labs/avalanchego/chains/atomic"
Comment thread
StephenButtolph marked this conversation as resolved.
)

var _ Unsigned = (*Export)(nil)
Expand Down Expand Up @@ -104,3 +106,33 @@ func (e *Export) asOp(avaxAssetID ids.ID) (op, error) {
burn: burn,
}, nil
}

func (e *Export) atomicRequests(txID ids.ID) (ids.ID, *chainsatomic.Requests, error) {
elems := make([]*chainsatomic.Element, len(e.ExportedOutputs))
for i, out := range e.ExportedOutputs {
utxo := &avax.UTXO{
UTXOID: avax.UTXOID{
TxID: txID,
OutputIndex: uint32(i), //#nosec G115 -- Won't overflow
},
Asset: out.Asset,
Out: out.Out,
}

utxoBytes, err := c.Marshal(codecVersion, utxo)
if err != nil {
return ids.ID{}, nil, err
}
utxoID := utxo.InputID()
elem := &chainsatomic.Element{
Key: utxoID[:],
Value: utxoBytes,
}
if o, ok := utxo.Out.(avax.Addressable); ok {
elem.Traits = o.Addresses()
}

elems[i] = elem
}
return e.DestinationChain, &chainsatomic.Requests{PutRequests: elems}, nil
}
11 changes: 11 additions & 0 deletions vms/saevm/cchain/tx/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"github.com/ava-labs/avalanchego/utils/math"
"github.com/ava-labs/avalanchego/vms/components/avax"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"

chainsatomic "github.com/ava-labs/avalanchego/chains/atomic"
)

var _ Unsigned = (*Import)(nil)
Expand Down Expand Up @@ -110,3 +112,12 @@ func (i *Import) asOp(avaxAssetID ids.ID) (op, error) {
mint: mint,
}, nil
}

func (i *Import) atomicRequests(ids.ID) (ids.ID, *chainsatomic.Requests, error) {
Comment thread
StephenButtolph marked this conversation as resolved.
utxoIDs := make([][]byte, len(i.ImportedInputs))
for j, in := range i.ImportedInputs {
inputID := in.InputID()
utxoIDs[j] = inputID[:]
}
return i.SourceChain, &chainsatomic.Requests{RemoveRequests: utxoIDs}, nil
}
12 changes: 12 additions & 0 deletions vms/saevm/cchain/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/saevm/hook"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"

chainsatomic "github.com/ava-labs/avalanchego/chains/atomic"
)

// Tx is a signed transaction that interacts with shared memory.
Expand All @@ -48,6 +50,10 @@ type Unsigned interface {
// asOp returns the operation that this transaction performs on the EVM
// state.
asOp(avaxAssetID ids.ID) (op, error)

// atomicRequests returns the operations that should be applied to shared
// memory when this transaction is executed.
atomicRequests(txID ids.ID) (chainID ids.ID, r *chainsatomic.Requests, err error)
}

// op contains the state changes of [hook.Op]
Expand Down Expand Up @@ -179,6 +185,12 @@ func gasPrice(cost uint64, gas gas.Gas) uint256.Int {
return p
}

// AtomicRequests returns shared-memory modifications that this transaction
// should perform on the peer chainID during execution.
func (t *Tx) AtomicRequests() (chainID ids.ID, r *chainsatomic.Requests, err error) {
return t.atomicRequests(t.ID())
}

// Parse deserializes a [Tx] from its canonical binary format.
func Parse(b []byte) (*Tx, error) {
var tx Tx
Expand Down
Loading
Loading