Commit f5af2e89 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into feat/goerli-contract-release

parents 1ced6f08 19da4fb9
...@@ -33,7 +33,7 @@ require ( ...@@ -33,7 +33,7 @@ require (
github.com/multiformats/go-multiaddr v0.11.0 github.com/multiformats/go-multiaddr v0.11.0
github.com/multiformats/go-multiaddr-dns v0.3.1 github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/olekukonko/tablewriter v0.0.5 github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/gomega v1.27.10 github.com/onsi/gomega v1.28.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/pkg/profile v1.7.0 github.com/pkg/profile v1.7.0
github.com/prometheus/client_golang v1.17.0 github.com/prometheus/client_golang v1.17.0
...@@ -161,7 +161,7 @@ require ( ...@@ -161,7 +161,7 @@ require (
github.com/multiformats/go-varint v0.0.7 // indirect github.com/multiformats/go-varint v0.0.7 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 // indirect github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 // indirect
github.com/onsi/ginkgo/v2 v2.11.0 // indirect github.com/onsi/ginkgo/v2 v2.12.0 // indirect
github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
......
...@@ -644,16 +644,16 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv ...@@ -644,16 +644,16 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI=
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
......
package op_e2e package op_e2e
import ( import (
"context"
"math" "math"
"math/big" "math/big"
"testing" "testing"
"time"
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth" "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/transactions"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive" "github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-service/testlog" "github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
...@@ -41,14 +42,14 @@ func TestERC20BridgeDeposits(t *testing.T) { ...@@ -41,14 +42,14 @@ func TestERC20BridgeDeposits(t *testing.T) {
// Deploy WETH9 // Deploy WETH9
weth9Address, tx, WETH9, err := bindings.DeployWETH9(opts, l1Client) weth9Address, tx, WETH9, err := bindings.DeployWETH9(opts, l1Client)
require.NoError(t, err) require.NoError(t, err)
_, err = geth.WaitForTransaction(tx.Hash(), l1Client, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) _, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err, "Waiting for deposit tx on L1") require.NoError(t, err, "Waiting for deposit tx on L1")
// Get some WETH // Get some WETH
opts.Value = big.NewInt(params.Ether) opts.Value = big.NewInt(params.Ether)
tx, err = WETH9.Fallback(opts, []byte{}) tx, err = WETH9.Fallback(opts, []byte{})
require.NoError(t, err) require.NoError(t, err)
_, err = geth.WaitForTransaction(tx.Hash(), l1Client, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) _, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err) require.NoError(t, err)
opts.Value = nil opts.Value = nil
wethBalance, err := WETH9.BalanceOf(&bind.CallOpts{}, opts.From) wethBalance, err := WETH9.BalanceOf(&bind.CallOpts{}, opts.From)
...@@ -62,7 +63,7 @@ func TestERC20BridgeDeposits(t *testing.T) { ...@@ -62,7 +63,7 @@ func TestERC20BridgeDeposits(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
tx, err = optimismMintableTokenFactory.CreateOptimismMintableERC20(l2Opts, weth9Address, "L2-WETH", "L2-WETH") tx, err = optimismMintableTokenFactory.CreateOptimismMintableERC20(l2Opts, weth9Address, "L2-WETH", "L2-WETH")
require.NoError(t, err) require.NoError(t, err)
_, err = geth.WaitForTransaction(tx.Hash(), l2Client, 3*time.Duration(cfg.DeployConfig.L2BlockTime)*time.Second) _, err = wait.ForReceiptOK(context.Background(), l2Client, tx.Hash())
require.NoError(t, err) require.NoError(t, err)
// Get the deployment event to have access to the L2 WETH9 address // Get the deployment event to have access to the L2 WETH9 address
...@@ -77,15 +78,17 @@ func TestERC20BridgeDeposits(t *testing.T) { ...@@ -77,15 +78,17 @@ func TestERC20BridgeDeposits(t *testing.T) {
// Approve WETH9 with the bridge // Approve WETH9 with the bridge
tx, err = WETH9.Approve(opts, cfg.L1Deployments.L1StandardBridgeProxy, new(big.Int).SetUint64(math.MaxUint64)) tx, err = WETH9.Approve(opts, cfg.L1Deployments.L1StandardBridgeProxy, new(big.Int).SetUint64(math.MaxUint64))
require.NoError(t, err) require.NoError(t, err)
_, err = geth.WaitForTransaction(tx.Hash(), l1Client, 6*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) _, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err) require.NoError(t, err)
// Bridge the WETH9 // Bridge the WETH9
l1StandardBridge, err := bindings.NewL1StandardBridge(cfg.L1Deployments.L1StandardBridgeProxy, l1Client) l1StandardBridge, err := bindings.NewL1StandardBridge(cfg.L1Deployments.L1StandardBridgeProxy, l1Client)
require.NoError(t, err) require.NoError(t, err)
tx, err = l1StandardBridge.BridgeERC20(opts, weth9Address, event.LocalToken, big.NewInt(100), 100000, []byte{}) tx, err = transactions.PadGasEstimate(opts, 1.1, func(opts *bind.TransactOpts) (*types.Transaction, error) {
return l1StandardBridge.BridgeERC20(opts, weth9Address, event.LocalToken, big.NewInt(100), 100000, []byte{})
})
require.NoError(t, err) require.NoError(t, err)
depositReceipt, err := geth.WaitForTransaction(tx.Hash(), l1Client, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) depositReceipt, err := wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err) require.NoError(t, err)
t.Log("Deposit through L1StandardBridge", "gas used", depositReceipt.GasUsed) t.Log("Deposit through L1StandardBridge", "gas used", depositReceipt.GasUsed)
...@@ -104,7 +107,7 @@ func TestERC20BridgeDeposits(t *testing.T) { ...@@ -104,7 +107,7 @@ func TestERC20BridgeDeposits(t *testing.T) {
depositTx, err := derive.UnmarshalDepositLogEvent(&depositEvent.Raw) depositTx, err := derive.UnmarshalDepositLogEvent(&depositEvent.Raw)
require.NoError(t, err) require.NoError(t, err)
_, err = geth.WaitForTransaction(types.NewTx(depositTx).Hash(), l2Client, 3*time.Duration(cfg.DeployConfig.L2BlockTime)*time.Second) _, err = wait.ForReceiptOK(context.Background(), l2Client, types.NewTx(depositTx).Hash())
require.NoError(t, err) require.NoError(t, err)
// Ensure that the deposit went through // Ensure that the deposit went through
......
...@@ -55,7 +55,6 @@ func WaitForL1OriginOnL2(l1BlockNum uint64, client *ethclient.Client, timeout ti ...@@ -55,7 +55,6 @@ func WaitForL1OriginOnL2(l1BlockNum uint64, client *ethclient.Client, timeout ti
} }
func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time.Duration) (*types.Receipt, error) { func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time.Duration) (*types.Receipt, error) {
timeoutCh := time.After(timeout)
ticker := time.NewTicker(100 * time.Millisecond) ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop() defer ticker.Stop()
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
...@@ -69,7 +68,7 @@ func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time ...@@ -69,7 +68,7 @@ func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time
} }
select { select {
case <-timeoutCh: case <-ctx.Done():
tip, err := client.BlockByNumber(context.Background(), nil) tip, err := client.BlockByNumber(context.Background(), nil)
if err != nil { if err != nil {
return nil, err return nil, err
......
...@@ -22,6 +22,8 @@ func ForReceiptFail(ctx context.Context, client *ethclient.Client, hash common.H ...@@ -22,6 +22,8 @@ func ForReceiptFail(ctx context.Context, client *ethclient.Client, hash common.H
} }
func ForReceipt(ctx context.Context, client *ethclient.Client, hash common.Hash, status uint64) (*types.Receipt, error) { func ForReceipt(ctx context.Context, client *ethclient.Client, hash common.Hash, status uint64) (*types.Receipt, error) {
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
ticker := time.NewTicker(100 * time.Millisecond) ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop() defer ticker.Stop()
for { for {
......
FROM ethereum/client-go:v1.13.1 FROM ethereum/client-go:v1.13.2
RUN apk add --no-cache jq RUN apk add --no-cache jq
......
...@@ -39,5 +39,7 @@ ...@@ -39,5 +39,7 @@
"eip1559Denominator": 50, "eip1559Denominator": 50,
"eip1559Elasticity": 6, "eip1559Elasticity": 6,
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"systemConfigStartBlock": 0 "systemConfigStartBlock": 0,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000"
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
"@testing-library/jest-dom": "^6.0.1", "@testing-library/jest-dom": "^6.0.1",
"@testing-library/react-hooks": "^8.0.1", "@testing-library/react-hooks": "^8.0.1",
"@types/glob": "^8.1.0", "@types/glob": "^8.1.0",
"@vitest/coverage-istanbul": "^0.34.1", "@vitest/coverage-istanbul": "^0.34.6",
"@wagmi/cli": "^1.5.2", "@wagmi/cli": "^1.5.2",
"@wagmi/core": "^1.3.8", "@wagmi/core": "^1.3.8",
"abitype": "^0.9.3", "abitype": "^0.9.3",
...@@ -80,6 +80,6 @@ ...@@ -80,6 +80,6 @@
"@testing-library/react": "^14.0.0", "@testing-library/react": "^14.0.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"viem": "^1.13.0" "viem": "^1.14.0"
} }
} }
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"node-fetch": "^2.6.7" "node-fetch": "^2.6.7"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.5.0", "@types/node": "^20.7.1",
"mocha": "^10.2.0" "mocha": "^10.2.0"
} }
} }
...@@ -37,14 +37,14 @@ ...@@ -37,14 +37,14 @@
"@eth-optimism/contracts-ts": "workspace:^", "@eth-optimism/contracts-ts": "workspace:^",
"@testing-library/jest-dom": "^6.0.1", "@testing-library/jest-dom": "^6.0.1",
"@testing-library/react-hooks": "^8.0.1", "@testing-library/react-hooks": "^8.0.1",
"@vitest/coverage-istanbul": "^0.34.1", "@vitest/coverage-istanbul": "^0.34.6",
"abitype": "^0.9.3", "abitype": "^0.9.3",
"isomorphic-fetch": "^3.0.0", "isomorphic-fetch": "^3.0.0",
"jest-dom": "link:@types/@testing-library/jest-dom", "jest-dom": "link:@types/@testing-library/jest-dom",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",
"tsup": "^7.2.0", "tsup": "^7.2.0",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"viem": "^1.13.0", "viem": "^1.14.0",
"vite": "^4.4.6", "vite": "^4.4.6",
"vitest": "^0.34.2" "vitest": "^0.34.2"
}, },
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
"@types/chai": "^4.3.6", "@types/chai": "^4.3.6",
"@types/chai-as-promised": "^7.1.5", "@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^10.0.2", "@types/mocha": "^10.0.2",
"@types/node": "^20.5.0", "@types/node": "^20.7.1",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"ethereum-waffle": "^4.0.10", "ethereum-waffle": "^4.0.10",
"ethers": "^5.7.2", "ethers": "^5.7.2",
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typedoc": "^0.25.1", "typedoc": "^0.25.1",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"viem": "^1.13.0", "viem": "^1.14.0",
"vitest": "^0.34.2", "vitest": "^0.34.2",
"zod": "^3.22.1" "zod": "^3.22.1"
}, },
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
"devDependencies": { "devDependencies": {
"@eth-optimism/contracts-ts": "workspace:^", "@eth-optimism/contracts-ts": "workspace:^",
"@swc/core": "^1.3.90", "@swc/core": "^1.3.90",
"@vitest/coverage-istanbul": "^0.34.1", "@vitest/coverage-istanbul": "^0.34.6",
"tsup": "^7.2.0", "tsup": "^7.2.0",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"viem": "^1.13.0", "viem": "^1.14.0",
"vite": "^4.4.9", "vite": "^4.4.9",
"vitest": "^0.34.1", "vitest": "^0.34.1",
"zod": "^3.22.0" "zod": "^3.22.0"
......
This diff is collapsed.
...@@ -64,7 +64,15 @@ then it must dispute claims positioned at odd depths in the game tree. ...@@ -64,7 +64,15 @@ then it must dispute claims positioned at odd depths in the game tree.
Otherwise, it disputes claims positioned at even depths in the game tree. Otherwise, it disputes claims positioned at even depths in the game tree.
This means an honest challenger only responds to claims made by the opposing team. This means an honest challenger only responds to claims made by the opposing team.
The next step is to determine whether the claim has a valid commitment (i.e. `ClaimHash`). The next step is to determine if the claim, now known to be for the opposing team,
disputes another claim the honest challenger _agrees_ with.
An honest challenger agrees with a claim iff every other claim along its path to the
root claim commits to a valid `ClaimHash`. Put differently, an honest challenger will
avoid countering a claim if it disagrees with the path of claims leading to that
specific claim. But if the honest challenger agrees with the path leading to the claim,
then the claim is countered.
The last step is to determine whether the claim has a valid commitment (i.e. `ClaimHash`).
If the `ClaimHash` matches the honest challenger's at the same trace index, then we If the `ClaimHash` matches the honest challenger's at the same trace index, then we
disagree with the claim's stance by moving to [defend](./fault-dispute-game.md#defend). disagree with the claim's stance by moving to [defend](./fault-dispute-game.md#defend).
Otherwise, the claim is [attacked](./fault-dispute-game.md#attack). Otherwise, the claim is [attacked](./fault-dispute-game.md#attack).
...@@ -77,18 +85,28 @@ class Team(Enum): ...@@ -77,18 +85,28 @@ class Team(Enum):
CHALLENGER = 1 CHALLENGER = 1
class Claim: class Claim:
parent: Claim
position: uint64 position: uint64
claim_hash: ClaimHash claim_hash: ClaimHash
MAX_TRACE = 2**MAX_GAME_DEPTH MAX_TRACE = 2**MAX_GAME_DEPTH
def agree_with(claim: Claim, chal_trace: List[ClaimHash, MAX_TRACE]):
if chal_trace[claim.trace_index] != claim.claim_hash:
return False
grand_parent = claim.parent.parent if claim.parent is not None else None
if grand_parent is not None:
return agree_with(grand_parent)
return True
def respond(claim: Claim, chal: Team, chal_trace: List[ClaimHash, MAX_TRACE]): def respond(claim: Claim, chal: Team, chal_trace: List[ClaimHash, MAX_TRACE]):
if depth(claim.position) % 2 != chal.value: if depth(claim.position) % 2 != chal.value:
if claim.parent is None or agree_with(claim.parent, chal_trace):
if chal_trace[trace_index(claim.position)] == claim.claim_hash: if chal_trace[trace_index(claim.position)] == claim.claim_hash:
defend() defend()
else: else:
attack() attack()
else: pass # no response else: pass # avoid supporting invalid claims on the same team
``` ```
In attack or defense, the honest challenger submit a `ClaimHash` corresponding to the In attack or defense, the honest challenger submit a `ClaimHash` corresponding to the
...@@ -111,10 +129,14 @@ invalid `ClaimHash` commitments. Otherwise, it issues a _defense step_. ...@@ -111,10 +129,14 @@ invalid `ClaimHash` commitments. Otherwise, it issues a _defense step_.
## Resolution ## Resolution
When the [chess clock](./fault-dispute-game.md#game-clock) of a `FaultDisputeGame` team When the [chess clock](./fault-dispute-game.md#game-clock) of a
runs out, the game can be resolved. [subgame root](./fault-dispute-game.md#resolution) has run out, the subgame can be resolved.
The honest challenger does this by calling the `resolve` function on the The honest challenger should resolve all subgames in bottom-up order, until the subgame
`FaultDisputeGame` contract. rooted at the FDG root is resolved.
The honest challenger accomplishes this by calling the `resolveClaim` function on the
`FaultDisputeGame` contract. Once the root claim's subgame is resolved,
the challenger then finally calls the `resolve` function to resolve the entire game.
The `FaultDisputeGame` does not put a time cap on resolution - because of the liveness The `FaultDisputeGame` does not put a time cap on resolution - because of the liveness
assumption on honest challengers and the bonds attached to the claims they’ve countered, assumption on honest challengers and the bonds attached to the claims they’ve countered,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment