Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
c04d3959
Commit
c04d3959
authored
Sep 06, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove concept of valid / invalid from alphabet game
parent
a0f1d5d9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
128 deletions
+38
-128
alphabetvm.go
op-bindings/bindings/alphabetvm.go
+2
-54
alphabetvm_more.go
op-bindings/bindings/alphabetvm_more.go
+2
-2
provider.go
op-challenger/game/fault/trace/alphabet/provider.go
+4
-13
provider_test.go
op-challenger/game/fault/trace/alphabet/provider_test.go
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+10
-10
FaultDisputeGame.t.sol
packages/contracts-bedrock/test/FaultDisputeGame.t.sol
+19
-48
No files found.
op-bindings/bindings/alphabetvm.go
View file @
c04d3959
...
@@ -30,8 +30,8 @@ var (
...
@@ -30,8 +30,8 @@ var (
// AlphabetVMMetaData contains all meta data concerning the AlphabetVM contract.
// AlphabetVMMetaData contains all meta data concerning the AlphabetVM contract.
var
AlphabetVMMetaData
=
&
bind
.
MetaData
{
var
AlphabetVMMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
Claim
\"
,
\"
name
\"
:
\"
_absolutePrestate
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
oracle
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
contractIPreimageOracle
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
uint8
\"
,
\"
name
\"
:
\"
_traceLength
\"
,
\"
type
\"
:
\"
uint8
\"
}],
\"
name
\"
:
\"
setTraceLength
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_stateData
\"
,
\"
type
\"
:
\"
bytes
\"
},{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
step
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
postState_
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
traceLength
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint8
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint8
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
ABI
:
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
Claim
\"
,
\"
name
\"
:
\"
_absolutePrestate
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
oracle
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
contractIPreimageOracle
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_stateData
\"
,
\"
type
\"
:
\"
bytes
\"
},{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
step
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
postState_
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x60a0604052
6000805460ff60a01b1916600f60a01b17905534801561002357600080fd5b50604051610c04380380610c04833981016040819052610042916100a3565b608081905260405161005390610096565b604051809103906000f08015801561006f573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b0392909216919091179055506100bc565b6106c58061053f83390190565b6000602082840312156100b557600080fd5b5051919050565b6080516104686100d7600039600061015801526104686000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80637dc0d1d014610051578063a13060eb1461009b578063a8a8b5eb146100d2578063f8e0cb961461012e575b600080fd5b6000546100719073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6000546100c09074010000000000000000000000000000000000000000900460ff1681565b60405160ff9091168152602001610092565b61012c6100e036600461028f565b6000805460ff90921674010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b005b61014161013c366004610302565b61014f565b604051908152602001610092565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b6008888860405161018b92919061036e565b6040518091039020901b036101b157600091506101aa8688018861037e565b90506101d0565b6101bd86880188610397565b9092509050816101cc816103e8565b9250505b816101dc826001610420565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925060006001600060149054906101000a900460ff166102249190610438565b60ff16830361023557506001610275565b60005461025f9060019074010000000000000000000000000000000000000000900460ff16610438565b60ff1683101561027157506003610275565b5060025b8060f81b60ff60f81b198516179350505050949350505050565b6000602082840312156102a157600080fd5b813560ff811681146102b257600080fd5b9392505050565b60008083601f8401126102cb57600080fd5b50813567ffffffffffffffff8111156102e357600080fd5b6020830191508360208285010111156102fb57600080fd5b9250929050565b6000806000806040858703121561031857600080fd5b843567ffffffffffffffff8082111561033057600080fd5b61033c888389016102b9565b9096509450602087013591508082111561035557600080fd5b50610362878288016102b9565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561039057600080fd5b5035919050565b600080604083850312156103aa57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610419576104196103b9565b5060010190565b60008219821115610433576104336103b9565b500190565b600060ff821660ff841680821015610452576104526103b9565b9003939250505
056fea164736f6c634300080f000a608060405234801561001057600080fd5b506106a5806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063e03110e11161005b578063e03110e114610111578063e159261114610139578063fe4ac08e1461014e578063fef2b4ed146101c357600080fd5b806361238bde146100825780638542cf50146100c05780639a1f5e7f146100fe575b600080fd5b6100ad610090366004610551565b600160209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6100ee6100ce366004610551565b600260209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100b7565b6100ad61010c366004610573565b6101e3565b61012461011f366004610551565b6102b6565b604080519283526020830191909152016100b7565b61014c6101473660046105a5565b6103a7565b005b61014c61015c366004610573565b6000838152600260209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558684528252808320968352958152858220939093559283529082905291902055565b6100ad6101d1366004610621565b60006020819052908152604090205481565b60006101ee856104b0565b90506101fb836008610669565b8211806102085750602083115b1561023f576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845287528083209483529386528382205581815293849052922055919050565b6000828152600260209081526040808320848452909152812054819060ff1661033f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b506000838152602081815260409091205461035b816008610669565b610366856020610669565b106103845783610377826008610669565b6103819190610681565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156103c65763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82161761054b81600090815233602052604090207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b92915050565b6000806040838503121561056457600080fd5b50508035926020909101359150565b6000806000806080858703121561058957600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000604084860312156105ba57600080fd5b83359250602084013567ffffffffffffffff808211156105d957600080fd5b818601915086601f8301126105ed57600080fd5b8135818111156105fc57600080fd5b87602082850101111561060e57600080fd5b6020830194508093505050509250925092565b60006020828403121561063357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561067c5761067c61063a565b500190565b6000828210156106935761069361063a565b50039056fea164736f6c634300080f000a"
,
Bin
:
"0x60a0604052
34801561001057600080fd5b50604051610add380380610add83398101604081905261002f91610090565b608081905260405161004090610083565b604051809103906000f08015801561005c573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b0392909216919091179055506100a9565b6106c58061041883390190565b6000602082840312156100a257600080fd5b5051919050565b6080516103556100c3600039600060af01526103556000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637dc0d1d01461003b578063f8e0cb9614610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610212565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600888886040516100e292919061027e565b6040518091039020901b0361010857600091506101018688018861028e565b9050610127565b610114868801886102a7565b909250905081610123816102f8565b9250505b81610133826001610330565b604080516020810193909352820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f010000000000000000000000000000000000000000000000000000000000000017979650505050505050565b60008083601f8401126101db57600080fd5b50813567ffffffffffffffff8111156101f357600080fd5b60208301915083602082850101111561020b57600080fd5b9250929050565b6000806000806040858703121561022857600080fd5b843567ffffffffffffffff8082111561024057600080fd5b61024c888389016101c9565b9096509450602087013591508082111561026557600080fd5b50610272878288016101c9565b95989497509550505050565b8183823760009101908152919050565b6000602082840312156102a057600080fd5b5035919050565b600080604083850312156102ba57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610329576103296102c9565b5060010190565b60008219821115610343576103436102c9565b50019
056fea164736f6c634300080f000a608060405234801561001057600080fd5b506106a5806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063e03110e11161005b578063e03110e114610111578063e159261114610139578063fe4ac08e1461014e578063fef2b4ed146101c357600080fd5b806361238bde146100825780638542cf50146100c05780639a1f5e7f146100fe575b600080fd5b6100ad610090366004610551565b600160209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6100ee6100ce366004610551565b600260209081526000928352604080842090915290825290205460ff1681565b60405190151581526020016100b7565b6100ad61010c366004610573565b6101e3565b61012461011f366004610551565b6102b6565b604080519283526020830191909152016100b7565b61014c6101473660046105a5565b6103a7565b005b61014c61015c366004610573565b6000838152600260209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558684528252808320968352958152858220939093559283529082905291902055565b6100ad6101d1366004610621565b60006020819052908152604090205481565b60006101ee856104b0565b90506101fb836008610669565b8211806102085750602083115b1561023f576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845287528083209483529386528382205581815293849052922055919050565b6000828152600260209081526040808320848452909152812054819060ff1661033f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b506000838152602081815260409091205461035b816008610669565b610366856020610669565b106103845783610377826008610669565b6103819190610681565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156103c65763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82161761054b81600090815233602052604090207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b92915050565b6000806040838503121561056457600080fd5b50508035926020909101359150565b6000806000806080858703121561058957600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000604084860312156105ba57600080fd5b83359250602084013567ffffffffffffffff808211156105d957600080fd5b818601915086601f8301126105ed57600080fd5b8135818111156105fc57600080fd5b87602082850101111561060e57600080fd5b6020830194508093505050509250925092565b60006020828403121561063357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561067c5761067c61063a565b500190565b6000828210156106935761069361063a565b50039056fea164736f6c634300080f000a"
,
}
}
// AlphabetVMABI is the input ABI used to generate the binding from.
// AlphabetVMABI is the input ABI used to generate the binding from.
...
@@ -262,55 +262,3 @@ func (_AlphabetVM *AlphabetVMSession) Step(_stateData []byte, arg1 []byte) ([32]
...
@@ -262,55 +262,3 @@ func (_AlphabetVM *AlphabetVMSession) Step(_stateData []byte, arg1 []byte) ([32]
func
(
_AlphabetVM
*
AlphabetVMCallerSession
)
Step
(
_stateData
[]
byte
,
arg1
[]
byte
)
([
32
]
byte
,
error
)
{
func
(
_AlphabetVM
*
AlphabetVMCallerSession
)
Step
(
_stateData
[]
byte
,
arg1
[]
byte
)
([
32
]
byte
,
error
)
{
return
_AlphabetVM
.
Contract
.
Step
(
&
_AlphabetVM
.
CallOpts
,
_stateData
,
arg1
)
return
_AlphabetVM
.
Contract
.
Step
(
&
_AlphabetVM
.
CallOpts
,
_stateData
,
arg1
)
}
}
// TraceLength is a free data retrieval call binding the contract method 0xa13060eb.
//
// Solidity: function traceLength() view returns(uint8)
func
(
_AlphabetVM
*
AlphabetVMCaller
)
TraceLength
(
opts
*
bind
.
CallOpts
)
(
uint8
,
error
)
{
var
out
[]
interface
{}
err
:=
_AlphabetVM
.
contract
.
Call
(
opts
,
&
out
,
"traceLength"
)
if
err
!=
nil
{
return
*
new
(
uint8
),
err
}
out0
:=
*
abi
.
ConvertType
(
out
[
0
],
new
(
uint8
))
.
(
*
uint8
)
return
out0
,
err
}
// TraceLength is a free data retrieval call binding the contract method 0xa13060eb.
//
// Solidity: function traceLength() view returns(uint8)
func
(
_AlphabetVM
*
AlphabetVMSession
)
TraceLength
()
(
uint8
,
error
)
{
return
_AlphabetVM
.
Contract
.
TraceLength
(
&
_AlphabetVM
.
CallOpts
)
}
// TraceLength is a free data retrieval call binding the contract method 0xa13060eb.
//
// Solidity: function traceLength() view returns(uint8)
func
(
_AlphabetVM
*
AlphabetVMCallerSession
)
TraceLength
()
(
uint8
,
error
)
{
return
_AlphabetVM
.
Contract
.
TraceLength
(
&
_AlphabetVM
.
CallOpts
)
}
// SetTraceLength is a paid mutator transaction binding the contract method 0xa8a8b5eb.
//
// Solidity: function setTraceLength(uint8 _traceLength) returns()
func
(
_AlphabetVM
*
AlphabetVMTransactor
)
SetTraceLength
(
opts
*
bind
.
TransactOpts
,
_traceLength
uint8
)
(
*
types
.
Transaction
,
error
)
{
return
_AlphabetVM
.
contract
.
Transact
(
opts
,
"setTraceLength"
,
_traceLength
)
}
// SetTraceLength is a paid mutator transaction binding the contract method 0xa8a8b5eb.
//
// Solidity: function setTraceLength(uint8 _traceLength) returns()
func
(
_AlphabetVM
*
AlphabetVMSession
)
SetTraceLength
(
_traceLength
uint8
)
(
*
types
.
Transaction
,
error
)
{
return
_AlphabetVM
.
Contract
.
SetTraceLength
(
&
_AlphabetVM
.
TransactOpts
,
_traceLength
)
}
// SetTraceLength is a paid mutator transaction binding the contract method 0xa8a8b5eb.
//
// Solidity: function setTraceLength(uint8 _traceLength) returns()
func
(
_AlphabetVM
*
AlphabetVMTransactorSession
)
SetTraceLength
(
_traceLength
uint8
)
(
*
types
.
Transaction
,
error
)
{
return
_AlphabetVM
.
Contract
.
SetTraceLength
(
&
_AlphabetVM
.
TransactOpts
,
_traceLength
)
}
op-bindings/bindings/alphabetvm_more.go
View file @
c04d3959
...
@@ -9,11 +9,11 @@ import (
...
@@ -9,11 +9,11 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
)
const
AlphabetVMStorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
test/FaultDisputeGame.t.sol:AlphabetVM
\"
,
\"
label
\"
:
\"
oracle
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_contract(IPreimageOracle)100
2
\"
},{
\"
astId
\"
:1001,
\"
contract
\"
:
\"
test/FaultDisputeGame.t.sol:AlphabetVM
\"
,
\"
label
\"
:
\"
traceLength
\"
,
\"
offset
\"
:20,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_uint8
\"
}],
\"
types
\"
:{
\"
t_contract(IPreimageOracle)1002
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
contract IPreimageOracle
\"
,
\"
numberOfBytes
\"
:
\"
20
\"
},
\"
t_uint8
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
uint8
\"
,
\"
numberOfBytes
\"
:
\"
1
\"
}}}"
const
AlphabetVMStorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
test/FaultDisputeGame.t.sol:AlphabetVM
\"
,
\"
label
\"
:
\"
oracle
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_contract(IPreimageOracle)100
1
\"
}],
\"
types
\"
:{
\"
t_contract(IPreimageOracle)1001
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
contract IPreimageOracle
\"
,
\"
numberOfBytes
\"
:
\"
20
\"
}}}"
var
AlphabetVMStorageLayout
=
new
(
solc
.
StorageLayout
)
var
AlphabetVMStorageLayout
=
new
(
solc
.
StorageLayout
)
var
AlphabetVMDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
4c5760003560e01c80637dc0d1d014610051578063a13060eb1461009b578063a8a8b5eb146100d2578063f8e0cb961461012e575b600080fd5b6000546100719073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6000546100c09074010000000000000000000000000000000000000000900460ff1681565b60405160ff9091168152602001610092565b61012c6100e036600461028f565b6000805460ff90921674010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b005b61014161013c366004610302565b61014f565b604051908152602001610092565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b6008888860405161018b92919061036e565b6040518091039020901b036101b157600091506101aa8688018861037e565b90506101d0565b6101bd86880188610397565b9092509050816101cc816103e8565b9250505b816101dc826001610420565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925060006001600060149054906101000a900460ff166102249190610438565b60ff16830361023557506001610275565b60005461025f9060019074010000000000000000000000000000000000000000900460ff16610438565b60ff1683101561027157506003610275565b5060025b8060f81b60ff60f81b198516179350505050949350505050565b6000602082840312156102a157600080fd5b813560ff811681146102b257600080fd5b9392505050565b60008083601f8401126102cb57600080fd5b50813567ffffffffffffffff8111156102e357600080fd5b6020830191508360208285010111156102fb57600080fd5b9250929050565b6000806000806040858703121561031857600080fd5b843567ffffffffffffffff8082111561033057600080fd5b61033c888389016102b9565b9096509450602087013591508082111561035557600080fd5b50610362878288016102b9565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561039057600080fd5b5035919050565b600080604083850312156103aa57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610419576104196103b9565b5060010190565b60008219821115610433576104336103b9565b500190565b600060ff821660ff841680821015610452576104526103b9565b9003939250505
056fea164736f6c634300080f000a"
var
AlphabetVMDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
365760003560e01c80637dc0d1d01461003b578063f8e0cb9614610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610212565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600888886040516100e292919061027e565b6040518091039020901b0361010857600091506101018688018861028e565b9050610127565b610114868801886102a7565b909250905081610123816102f8565b9250505b81610133826001610330565b604080516020810193909352820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f010000000000000000000000000000000000000000000000000000000000000017979650505050505050565b60008083601f8401126101db57600080fd5b50813567ffffffffffffffff8111156101f357600080fd5b60208301915083602082850101111561020b57600080fd5b9250929050565b6000806000806040858703121561022857600080fd5b843567ffffffffffffffff8082111561024057600080fd5b61024c888389016101c9565b9096509450602087013591508082111561026557600080fd5b50610272878288016101c9565b95989497509550505050565b8183823760009101908152919050565b6000602082840312156102a057600080fd5b5035919050565b600080604083850312156102ba57600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610329576103296102c9565b5060010190565b60008219821115610343576103436102c9565b50019
056fea164736f6c634300080f000a"
func
init
()
{
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
AlphabetVMStorageLayoutJSON
),
AlphabetVMStorageLayout
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
AlphabetVMStorageLayoutJSON
),
AlphabetVMStorageLayout
);
err
!=
nil
{
...
...
op-challenger/game/fault/trace/alphabet/provider.go
View file @
c04d3959
...
@@ -59,7 +59,7 @@ func (ap *AlphabetTraceProvider) Get(ctx context.Context, i uint64) (common.Hash
...
@@ -59,7 +59,7 @@ func (ap *AlphabetTraceProvider) Get(ctx context.Context, i uint64) (common.Hash
if
err
!=
nil
{
if
err
!=
nil
{
return
common
.
Hash
{},
err
return
common
.
Hash
{},
err
}
}
return
a
p
.
a
lphabetStateHash
(
claimBytes
),
nil
return
alphabetStateHash
(
claimBytes
),
nil
}
}
// AbsolutePreState returns the absolute pre-state for the alphabet trace.
// AbsolutePreState returns the absolute pre-state for the alphabet trace.
...
@@ -78,7 +78,7 @@ func (ap *AlphabetTraceProvider) AbsolutePreStateCommitment(ctx context.Context)
...
@@ -78,7 +78,7 @@ func (ap *AlphabetTraceProvider) AbsolutePreStateCommitment(ctx context.Context)
}
}
func
(
ap
*
AlphabetTraceProvider
)
StateHash
(
ctx
context
.
Context
,
state
[]
byte
)
(
common
.
Hash
,
error
)
{
func
(
ap
*
AlphabetTraceProvider
)
StateHash
(
ctx
context
.
Context
,
state
[]
byte
)
(
common
.
Hash
,
error
)
{
return
a
p
.
a
lphabetStateHash
(
state
),
nil
return
alphabetStateHash
(
state
),
nil
}
}
// BuildAlphabetPreimage constructs the claim bytes for the index and state item.
// BuildAlphabetPreimage constructs the claim bytes for the index and state item.
...
@@ -86,18 +86,9 @@ func BuildAlphabetPreimage(i uint64, letter string) []byte {
...
@@ -86,18 +86,9 @@ func BuildAlphabetPreimage(i uint64, letter string) []byte {
return
append
(
IndexToBytes
(
i
),
LetterToBytes
(
letter
)
...
)
return
append
(
IndexToBytes
(
i
),
LetterToBytes
(
letter
)
...
)
}
}
func
(
ap
*
AlphabetTraceProvider
)
alphabetStateHash
(
state
[]
byte
)
common
.
Hash
{
func
alphabetStateHash
(
state
[]
byte
)
common
.
Hash
{
h
:=
crypto
.
Keccak256Hash
(
state
)
h
:=
crypto
.
Keccak256Hash
(
state
)
// instead of the state containing an "exited" boolean, we just check if the index reached the end
h
[
0
]
=
mipsevm
.
VMStatusInvalid
i
:=
new
(
big
.
Int
)
.
SetBytes
(
state
[
:
32
])
finalStateIdx
:=
uint64
(
len
(
ap
.
state
)
-
1
)
if
!
i
.
IsUint64
()
||
i
.
Uint64
()
>
finalStateIdx
{
h
[
0
]
=
mipsevm
.
VMStatusPanic
// this state should never be reached, if we increment by 1 per step
}
else
if
i
.
Uint64
()
==
finalStateIdx
{
h
[
0
]
=
mipsevm
.
VMStatusInvalid
}
else
{
h
[
0
]
=
mipsevm
.
VMStatusUnfinished
}
return
h
return
h
}
}
...
...
op-challenger/game/fault/trace/alphabet/provider_test.go
View file @
c04d3959
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
)
)
func
alphabetClaim
(
index
uint64
,
letter
string
,
provider
*
AlphabetTraceProvider
)
common
.
Hash
{
func
alphabetClaim
(
index
uint64
,
letter
string
,
provider
*
AlphabetTraceProvider
)
common
.
Hash
{
return
provider
.
alphabetStateHash
(
BuildAlphabetPreimage
(
index
,
letter
))
return
alphabetStateHash
(
BuildAlphabetPreimage
(
index
,
letter
))
}
}
// TestAlphabetProvider_Get_ClaimsByTraceIndex tests the [fault.AlphabetProvider] Get function.
// TestAlphabetProvider_Get_ClaimsByTraceIndex tests the [fault.AlphabetProvider] Get function.
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
c04d3959
...
@@ -88,16 +88,16 @@ FaucetTest:test_nonAdmin_drip_fails() (gas: 262520)
...
@@ -88,16 +88,16 @@ FaucetTest:test_nonAdmin_drip_fails() (gas: 262520)
FaucetTest:test_receive_succeeds() (gas: 17401)
FaucetTest:test_receive_succeeds() (gas: 17401)
FaucetTest:test_withdraw_nonAdmin_reverts() (gas: 13145)
FaucetTest:test_withdraw_nonAdmin_reverts() (gas: 13145)
FaucetTest:test_withdraw_succeeds() (gas: 78359)
FaucetTest:test_withdraw_succeeds() (gas: 78359)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot1:test_resolvesCorrectly_succeeds() (gas:
509652
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot1:test_resolvesCorrectly_succeeds() (gas:
499197
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 5
16910
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 5
06057
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 5
13211
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 5
02738
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 5
16451
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 5
05955
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 5
14790
)
FaultDisputeGame_ResolvesCorrectly_CorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 5
05224
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1:test_resolvesCorrectly_succeeds() (gas:
508417
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1:test_resolvesCorrectly_succeeds() (gas:
497962
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 5
15675
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2:test_resolvesCorrectly_succeeds() (gas: 5
04822
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 5
11976
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3:test_resolvesCorrectly_succeeds() (gas: 5
01503
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 5
13216
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4:test_resolvesCorrectly_succeeds() (gas: 5
02720
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 5
11555
)
FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5:test_resolvesCorrectly_succeeds() (gas: 5
01989
)
FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 640504)
FaultDisputeGame_Test:test_addLocalData_static_succeeds() (gas: 640504)
FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10342)
FaultDisputeGame_Test:test_createdAt_succeeds() (gas: 10342)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32377)
FaultDisputeGame_Test:test_extraData_succeeds() (gas: 32377)
...
...
packages/contracts-bedrock/test/FaultDisputeGame.t.sol
View file @
c04d3959
...
@@ -515,19 +515,19 @@ contract GamePlayer {
...
@@ -515,19 +515,19 @@ contract GamePlayer {
(,, Claim grandparentClaim, Position grandparentPos,) = gameProxy.claimData(grandparentIndex);
(,, Claim grandparentClaim, Position grandparentPos,) = gameProxy.claimData(grandparentIndex);
Claim ourGrandparentClaim = claimAt(grandparentPos);
Claim ourGrandparentClaim = claimAt(grandparentPos);
if (Claim.unwrap(ourParentClaim)
<< 8 != Claim.unwrap(parentClaim) << 8
) {
if (Claim.unwrap(ourParentClaim)
!= Claim.unwrap(parentClaim)
) {
// Attack parent.
// Attack parent.
movePos = parentPos.move(true);
movePos = parentPos.move(true);
// If we also disagree with the grandparent, attack it as well.
// If we also disagree with the grandparent, attack it as well.
if (Claim.unwrap(ourGrandparentClaim)
<< 8 != Claim.unwrap(grandparentClaim) << 8
) {
if (Claim.unwrap(ourGrandparentClaim)
!= Claim.unwrap(grandparentClaim)
) {
movePos2 = grandparentPos.move(true);
movePos2 = grandparentPos.move(true);
}
}
// Flag the move as an attack.
// Flag the move as an attack.
isAttack = true;
isAttack = true;
} else if (
} else if (
Claim.unwrap(ourParentClaim)
<< 8 == Claim.unwrap(parentClaim) << 8
Claim.unwrap(ourParentClaim)
== Claim.unwrap(parentClaim)
&& Claim.unwrap(ourGrandparentClaim)
<< 8 == Claim.unwrap(grandparentClaim) << 8
&& Claim.unwrap(ourGrandparentClaim)
== Claim.unwrap(grandparentClaim)
) {
) {
movePos = parentPos.move(false);
movePos = parentPos.move(false);
}
}
...
@@ -611,16 +611,8 @@ contract GamePlayer {
...
@@ -611,16 +611,8 @@ contract GamePlayer {
function claimAt(uint256 _traceIndex) public view returns (Claim claim_) {
function claimAt(uint256 _traceIndex) public view returns (Claim claim_) {
bytes32 hash =
bytes32 hash =
keccak256(abi.encode(_traceIndex >= trace.length ? trace.length - 1 : _traceIndex, traceAt(_traceIndex)));
keccak256(abi.encode(_traceIndex >= trace.length ? trace.length - 1 : _traceIndex, traceAt(_traceIndex)));
uint256 status;
if (_traceIndex == trace.length - 1) {
status = 1;
} else if (_traceIndex < trace.length - 1) {
status = 3;
} else {
status = 2;
}
assembly {
assembly {
claim_ := or(and(hash, not(shl(248, 0xFF))), shl(248,
status
))
claim_ := or(and(hash, not(shl(248, 0xFF))), shl(248,
1
))
}
}
}
}
...
@@ -635,14 +627,13 @@ contract OneVsOne_Arena is FaultDisputeGame_Init {
...
@@ -635,14 +627,13 @@ contract OneVsOne_Arena is FaultDisputeGame_Init {
bytes ABSOLUTE_PRESTATE = abi.encode(15);
bytes ABSOLUTE_PRESTATE = abi.encode(15);
/// @dev The absolute prestate claim.
/// @dev The absolute prestate claim.
Claim internal constant ABSOLUTE_PRESTATE_CLAIM =
Claim internal constant ABSOLUTE_PRESTATE_CLAIM =
Claim.wrap(bytes32((uint256(3) << 248) |
uint256(keccak256(abi.encode(15
)))));
Claim.wrap(bytes32((uint256(3) << 248) |
(~uint256(0xFF << 248) & uint256(keccak256(abi.encode(15)
)))));
/// @dev The defender.
/// @dev The defender.
GamePlayer internal defender;
GamePlayer internal defender;
/// @dev The challenger.
/// @dev The challenger.
GamePlayer internal challenger;
GamePlayer internal challenger;
function init(
function init(
bool defenderCorrect,
GamePlayer _defender,
GamePlayer _defender,
GamePlayer _challenger,
GamePlayer _challenger,
uint256 _finalTraceIndex
uint256 _finalTraceIndex
...
@@ -658,11 +649,6 @@ contract OneVsOne_Arena is FaultDisputeGame_Init {
...
@@ -658,11 +649,6 @@ contract OneVsOne_Arena is FaultDisputeGame_Init {
defender.init(gameProxy, challenger, vm);
defender.init(gameProxy, challenger, vm);
challenger.init(gameProxy, defender, vm);
challenger.init(gameProxy, defender, vm);
// Set the expected trace length to the defender's trace length.
AlphabetVM(address(gameProxy.VM())).setTraceLength(
uint8((defenderCorrect ? _defender : _challenger).trace().length)
);
// Label actors for trace.
// Label actors for trace.
vm.label(address(challenger), "Challenger");
vm.label(address(challenger), "Challenger");
vm.label(address(defender), "Defender");
vm.label(address(defender), "Defender");
...
@@ -673,7 +659,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1 is OneVsOne_Arena {
...
@@ -673,7 +659,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot1 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 0);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 0);
super.init(
false,
dishonest, honest, 15);
super.init(dishonest, honest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -694,7 +680,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot1 is OneVsOne_Arena {
...
@@ -694,7 +680,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot1 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 0);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 0);
super.init(
true,
honest, dishonest, 15);
super.init(honest, dishonest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -715,7 +701,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2 is OneVsOne_Arena {
...
@@ -715,7 +701,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot2 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 7);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 7);
super.init(
false,
dishonest, honest, 15);
super.init(dishonest, honest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -736,7 +722,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot2 is OneVsOne_Arena {
...
@@ -736,7 +722,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot2 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 7);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 7);
super.init(
true,
honest, dishonest, 15);
super.init(honest, dishonest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -757,7 +743,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3 is OneVsOne_Arena {
...
@@ -757,7 +743,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot3 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 2);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 2);
super.init(
false,
dishonest, honest, 15);
super.init(dishonest, honest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -778,7 +764,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot3 is OneVsOne_Arena {
...
@@ -778,7 +764,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot3 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 2);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 16, 2);
super.init(
true,
honest, dishonest, 15);
super.init(honest, dishonest, 15);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -799,7 +785,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4 is OneVsOne_Arena {
...
@@ -799,7 +785,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot4 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer_HalfTrace(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer_HalfTrace(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 8, 5);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 8, 5);
super.init(
false,
dishonest, honest, 7);
super.init(dishonest, honest, 7);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -820,7 +806,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot4 is OneVsOne_Arena {
...
@@ -820,7 +806,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot4 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer_HalfTrace(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer_HalfTrace(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 8, 5);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 8, 5);
super.init(
true,
honest, dishonest, 7);
super.init(honest, dishonest, 7);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -841,7 +827,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5 is OneVsOne_Arena {
...
@@ -841,7 +827,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRoot5 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer_QuarterTrace(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer_QuarterTrace(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 4, 3);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 4, 3);
super.init(
false,
dishonest, honest, 3);
super.init(dishonest, honest, 3);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -862,7 +848,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot5 is OneVsOne_Arena {
...
@@ -862,7 +848,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRoot5 is OneVsOne_Arena {
function setUp() public override {
function setUp() public override {
GamePlayer honest = new HonestPlayer_QuarterTrace(ABSOLUTE_PRESTATE);
GamePlayer honest = new HonestPlayer_QuarterTrace(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 4, 3);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, 4, 3);
super.init(
true,
honest, dishonest, 3);
super.init(honest, dishonest, 3);
}
}
function test_resolvesCorrectly_succeeds() public {
function test_resolvesCorrectly_succeeds() public {
...
@@ -892,7 +878,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRootFuzz is OneVsOne_Arena
...
@@ -892,7 +878,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRootFuzz is OneVsOne_Arena
_dishonestTraceLength,
_dishonestTraceLength,
i
i
);
);
super.init(
false,
dishonest, honest, _dishonestTraceLength - 1);
super.init(dishonest, honest, _dishonestTraceLength - 1);
// Play the game until a step is forced.
// Play the game until a step is forced.
challenger.play(0);
challenger.play(0);
...
@@ -922,7 +908,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRootFuzz is OneVsOne_Arena {
...
@@ -922,7 +908,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRootFuzz is OneVsOne_Arena {
_dishonestTraceLength,
_dishonestTraceLength,
i
i
);
);
super.init(
true,
honest, dishonest, 15);
super.init(honest, dishonest, 15);
// Play the game until a step is forced.
// Play the game until a step is forced.
challenger.play(0);
challenger.play(0);
...
@@ -997,18 +983,11 @@ contract AlphabetVM is IBigStepper {
...
@@ -997,18 +983,11 @@ contract AlphabetVM is IBigStepper {
Claim internal immutable ABSOLUTE_PRESTATE;
Claim internal immutable ABSOLUTE_PRESTATE;
IPreimageOracle public oracle;
IPreimageOracle public oracle;
uint8 public traceLength = 15;
constructor(Claim _absolutePrestate) {
constructor(Claim _absolutePrestate) {
ABSOLUTE_PRESTATE = _absolutePrestate;
ABSOLUTE_PRESTATE = _absolutePrestate;
oracle = new PreimageOracle();
oracle = new PreimageOracle();
}
}
/// @notice Sets the expected trace length.
function setTraceLength(uint8 _traceLength) public {
traceLength = _traceLength;
}
/// @inheritdoc IBigStepper
/// @inheritdoc IBigStepper
function step(bytes calldata _stateData, bytes calldata) external view returns (bytes32 postState_) {
function step(bytes calldata _stateData, bytes calldata) external view returns (bytes32 postState_) {
uint256 traceIndex;
uint256 traceIndex;
...
@@ -1024,16 +1003,8 @@ contract AlphabetVM is IBigStepper {
...
@@ -1024,16 +1003,8 @@ contract AlphabetVM is IBigStepper {
}
}
// STF: n -> n + 1
// STF: n -> n + 1
postState_ = keccak256(abi.encode(traceIndex, claim + 1));
postState_ = keccak256(abi.encode(traceIndex, claim + 1));
VMStatus status;
if (traceIndex == traceLength - 1) {
status = VMStatuses.INVALID;
} else if (traceIndex < traceLength - 1) {
status = VMStatuses.UNFINISHED;
} else {
status = VMStatuses.PANIC;
}
assembly {
assembly {
postState_ := or(and(postState_, not(shl(248, 0xFF))), shl(248,
status
))
postState_ := or(and(postState_, not(shl(248, 0xFF))), shl(248,
1
))
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment