Skip to content

Commit

Permalink
Merge branch 'main' into gp-address
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Apr 26, 2024
2 parents 1848693 + 37525d8 commit c02eaf0
Show file tree
Hide file tree
Showing 34 changed files with 2,239 additions and 121 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/taikoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-2cb875799419c907cc3709e586ece2559e6b340e
uses: foundry-rs/[email protected]

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies
Expand All @@ -35,6 +33,10 @@ jobs:
working-directory: ./packages/taikoon
run: forge fmt --check

- name: Solidity compilation
working-directory: ./packages/taikoon
run: pnpm compile

- name: Unit Tests
working-directory: ./packages/taikoon
run: pnpm clean && pnpm test
run: pnpm test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import { AddressInputState } from '$components/Bridge/SharedBridgeComponents/AddressInput/state';
import { enteredAmount, selectedNFTs, selectedToken, tokenBalance } from '$components/Bridge/state';
import { importDone } from '$components/Bridge/state';
1;
import { detectContractType, type NFT, TokenType } from '$libs/token';
import { checkOwnership } from '$libs/token/checkOwnership';
import { getTokenWithInfoFromAddress } from '$libs/token/getTokenWithInfoFromAddress';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ contract AutomataDcapV3Attestation is IAttestation {
return status == TCBInfoStruct.TCBStatus.OK
|| status == TCBInfoStruct.TCBStatus.TCB_SW_HARDENING_NEEDED
|| status == TCBInfoStruct.TCBStatus.TCB_CONFIGURATION_AND_SW_HARDENING_NEEDED
|| status == TCBInfoStruct.TCBStatus.TCB_OUT_OF_DATE
|| status == TCBInfoStruct.TCBStatus.TCB_OUT_OF_DATE_CONFIGURATION_NEEDED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"pcesvn": 13
},
"tcbDate": "2023-02-15T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -121,7 +121,7 @@
"pcesvn": 13
},
"tcbDate": "2021-11-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -167,7 +167,7 @@
"pcesvn": 11
},
"tcbDate": "2021-11-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -190,7 +190,7 @@
"pcesvn": 10
},
"tcbDate": "2020-11-11T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -259,7 +259,7 @@
"pcesvn": 10
},
"tcbDate": "2020-06-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -305,7 +305,7 @@
"pcesvn": 10
},
"tcbDate": "2019-12-11T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -351,7 +351,7 @@
"pcesvn": 9
},
"tcbDate": "2019-11-13T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -397,7 +397,7 @@
"pcesvn": 7
},
"tcbDate": "2019-05-15T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -420,7 +420,7 @@
"pcesvn": 7
},
"tcbDate": "2019-01-09T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -443,7 +443,7 @@
"pcesvn": 6
},
"tcbDate": "2018-08-15T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"pcesvn": 13
},
"tcbDate": "2023-02-15T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -121,7 +121,7 @@
"pcesvn": 13
},
"tcbDate": "2022-11-09T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -167,7 +167,7 @@
"pcesvn": 11
},
"tcbDate": "2021-11-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -190,7 +190,7 @@
"pcesvn": 10
},
"tcbDate": "2020-11-11T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -259,7 +259,7 @@
"pcesvn": 5
},
"tcbDate": "2018-01-04T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"pcesvn": 13
},
"tcbDate": "2023-02-15T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -121,7 +121,7 @@
"pcesvn": 13
},
"tcbDate": "2022-08-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand Down Expand Up @@ -167,7 +167,7 @@
"pcesvn": 11
},
"tcbDate": "2021-11-10T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -190,7 +190,7 @@
"pcesvn": 10
},
"tcbDate": "2020-11-11T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
},
{
"tcb": {
Expand All @@ -213,7 +213,7 @@
"pcesvn": 5
},
"tcbDate": "2018-01-04T00:00:00Z",
"tcbStatus": "OutOfDate"
"tcbStatus": "OutOfDateConfigurationNeeded"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract AttestationBase is Test, DcapTestUtils, V3QuoteParseUtils {
// use a network that where the P256Verifier contract exists
// ref: https://github.com/daimo-eth/p256-verifier
//string internal rpcUrl = vm.envString("RPC_URL");
string internal tcbInfoPath = "/test/automata-attestation/assets/0923/tcbInfo_00606A000000.json";
string internal tcbInfoPath = "/test/automata-attestation/assets/0923/tcb_00606A000000.json";
string internal idPath = "/test/automata-attestation/assets/0923/identity.json";
address constant admin = address(1);
address constant user = 0x0926b716f6aEF52F9F3C3474A2846e1Bf1ACedf6;
Expand Down
3 changes: 0 additions & 3 deletions packages/relayer/pkg/proof/block_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package proof

import (
"context"
"log/slog"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
Expand All @@ -27,8 +26,6 @@ func (p *Prover) blockHeader(
return encoding.BlockHeader{}, errors.Wrap(err, "blocker.BlockByNumber")
}
} else {
slog.Info("getting block by hash", "blockHash", blockHash.Hex())

b, err = blocker.BlockByHash(ctx, blockHash)
if err != nil {
return encoding.BlockHeader{}, errors.Wrap(err, "blocker.BlockByHash")
Expand Down
8 changes: 0 additions & 8 deletions packages/relayer/pkg/proof/encoded_signal_proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"math/big"

"log/slog"

"github.com/taikoxyz/taiko-mono/packages/relayer"
"github.com/taikoxyz/taiko-mono/packages/relayer/pkg/encoding"

Expand Down Expand Up @@ -89,12 +87,6 @@ func (p *Prover) getProof(
) (*StorageProof, error) {
var ethProof StorageProof

slog.Info("getting proof",
"signalServiceAddress", signalServiceAddress.Hex(),
"key", key,
"blockNum", blockNumber,
)

err := c.CallContext(ctx,
&ethProof,
"eth_getProof",
Expand Down
13 changes: 9 additions & 4 deletions packages/relayer/processor/is_profitable.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import (

"log/slog"

"github.com/pkg/errors"
"github.com/taikoxyz/taiko-mono/packages/relayer"
)

var (
errImpossible = errors.New("impossible to process")
)

// isProfitable determines whether a message is profitable or not. It should
// check the processing fee, if one does not exist at all, it is definitely not
// profitable. Otherwise, we compare it to the estimated cost.
Expand All @@ -26,13 +31,13 @@ func (p *Processor) isProfitable(
"gasLimit", gasLimit,
)

return shouldProcess, nil
return shouldProcess, errImpossible
}

// if processing fee is higher than baseFee * gasLimit,
// we should process.
res := (destChainBaseFee + gasTipCap) * uint64(gasLimit)
if fee > res {
estimatedOnchainFee := (destChainBaseFee + gasTipCap) * uint64(gasLimit)
if fee > estimatedOnchainFee {
shouldProcess = true
}

Expand All @@ -41,7 +46,7 @@ func (p *Processor) isProfitable(
"destChainBaseFee", destChainBaseFee,
"gasLimit", gasLimit,
"shouldProcess", shouldProcess,
"result", res,
"estimatedOnchainFee", estimatedOnchainFee,
)

if !shouldProcess {
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/processor/is_profitable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func Test_isProfitable(t *testing.T) {
1,
1,
false,
nil,
errImpossible,
},
{
"profitable",
Expand Down
21 changes: 4 additions & 17 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,10 @@ func (p *Processor) processMessage(
return false, nil
}

slog.Info("waiting for confirmations",
"msgHash", common.BytesToHash(msgBody.Event.MsgHash[:]).Hex(),
)

if err := p.waitForConfirmations(ctx, msgBody.Event.Raw.TxHash, msgBody.Event.Raw.BlockNumber); err != nil {
return false, err
}

slog.Info("done waiting for confirmations",
"msgHash", common.BytesToHash(msgBody.Event.MsgHash[:]).Hex(),
)

encodedSignalProof, err := p.generateEncodedSignalProof(ctx, msgBody.Event)
if err != nil {
return false, err
Expand Down Expand Up @@ -314,11 +306,6 @@ func (p *Processor) sendProcessMessageCall(
return nil, err
}

slog.Info("message received on dest chain",
"received", received,
"srcTxHash", event.Raw.TxHash.Hex(),
)

// message will fail when we try to process it
if !received {
slog.Warn("Message not received on dest chain",
Expand Down Expand Up @@ -360,6 +347,10 @@ func (p *Processor) sendProcessMessageCall(
gasTipCap.Uint64(),
)
if err != nil || !profitable {
if err == errImpossible {
return nil, errImpossible
}

return nil, relayer.ErrUnprofitable
}
// now simulate the transaction and lets confirm
Expand Down Expand Up @@ -519,9 +510,5 @@ func (p *Processor) getBaseFee(ctx context.Context) (*big.Int, error) {
baseFee = eip1559.CalcBaseFee(cfg, blk.Header())
}

slog.Info("destChain base fee",
"baseFee", baseFee.String(),
)

return baseFee, nil
}
11 changes: 11 additions & 0 deletions packages/taikoon/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
LOCALHOST_PRIVATE_KEY=
LOCALHOST_ADDRESS=
HOLESKY_PRIVATE_KEY=
HOLESKY_ADDRESS=
DEVNET_PRIVATE_KEY=
DEVNET_ADDRESS=
SEPOLIA_PRIVATE_KEY=
SEPOLIA_ADDRESS=
KATLA_PRIVATE_KEY=
KATLA_ADDRESS=
IPFS_BASE_URI=
10 changes: 10 additions & 0 deletions packages/taikoon/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ broadcast

#coverage
lcov.info

# Custom
broadcast
.states
coverage
data/original
data/images
data/metadata
lcov.info
lib
Loading

0 comments on commit c02eaf0

Please sign in to comment.