Commit 1b908768 authored by vicotor's avatar vicotor

update proto

parent 6b703c0d
......@@ -34,8 +34,11 @@ func (e *ExChainAPI) OutputV0AtBlock(ctx context.Context, blockHash common.Hash)
}
func (e *ExChainAPI) ChainID(ctx context.Context) (*big.Int, error) {
//TODO implement me
panic("implement me")
id, err := e.chain.ChainId()
if err != nil {
return nil, err
}
return new(big.Int).SetUint64(id.Uint64()), nil
}
func (e *ExChainAPI) NewPayload(params exchain.PayloadParams) (exchain.ExecutionResult, error) {
......
......@@ -32,6 +32,7 @@ message TransactionReceipt {
LimitOrderReceipt limit_r = 11;
MarketOrderReceipt market_r = 12;
CancelOrderReceipt cancel_r = 13;
ProtocolTransactionReceipt protocol_r = 14;
}
}
......@@ -60,3 +61,6 @@ message MarketOrderReceipt {
message CancelOrderReceipt {
string order_id = 1;
}
message ProtocolTransactionReceipt {
}
......@@ -24,6 +24,7 @@ enum TxType {
LimitTx = 5;
MarketTx = 6;
CancelTx = 7;
ProtocolTx = 8;
}
message Signature {
......@@ -50,8 +51,9 @@ message Transaction {
LimitOrderTransaction limit_tx = 10;
MarketOrderTransaction market_tx = 11;
CancelOrderTransaction cancel_tx = 12;
ProtocolTransaction protocol_tx = 13;
}
Signature signature = 13;
Signature signature = 14;
}
message SignProxyTransaction {
......@@ -97,3 +99,11 @@ message MarketOrderTransaction {
message CancelOrderTransaction {
string order_id = 1;
}
message ProtocolTransaction {
uint64 l1_number = 1;
uint64 l1_time = 2;
bytes l1_block_hash = 3;
uint64 sequence_number = 4;
bytes batcher_addr = 5;
}
......@@ -3,7 +3,6 @@ package derive
import (
"encoding/binary"
"fmt"
"github.com/exchain/go-exchain/op-node/rollup"
"github.com/exchain/go-exchain/op-service/eth"
)
......@@ -22,11 +21,21 @@ func PayloadToBlockRef(rollupCfg *rollup.Config, payload *eth.ExecutionPayload)
sequenceNumber = 0
} else {
// todo: vicotor implement this.
data := make([]byte, 0)
info, err := L1BlockInfoFromBytes(rollupCfg, uint64(payload.Timestamp), data)
if err != nil {
return eth.L2BlockRef{}, fmt.Errorf("failed to parse L1 info deposit tx from L2 block: %w", err)
}
//if len(payload.Transactions) == 0 {
// return eth.L2BlockRef{}, fmt.Errorf("l2 block is missing L1 info deposit tx, block hash: %s", payload.BlockHash)
//}
//var tx types.Transaction
//if err := tx.UnmarshalBinary(payload.Transactions[0]); err != nil {
// return eth.L2BlockRef{}, fmt.Errorf("failed to decode first tx to read l1 info from: %w", err)
//}
//if tx.Type() != types.DepositTxType {
// return eth.L2BlockRef{}, fmt.Errorf("first payload tx has unexpected tx type: %d", tx.Type())
//}
info, err := L1BlockInfoFromBytes(rollupCfg, uint64(payload.Timestamp), tx.Data())
//if err != nil {
// return eth.L2BlockRef{}, fmt.Errorf("failed to parse L1 info deposit tx from L2 block: %w", err)
//}
//l1Origin = eth.BlockID{Hash: info.BlockHash, Number: info.Number}
l1Origin = eth.BlockID{Hash: info.BlockHash, Number: info.Number}
sequenceNumber = info.SequenceNumber
}
......
......@@ -37,11 +37,11 @@ func (eq *EngDeriver) onBuildStart(ev BuildStartEvent) {
eq.emitter.Emit(rollup.CriticalErrorEvent{Err: err}) // make the node exit, things are very wrong.
return
}
fc := eth.ForkchoiceState{
HeadBlockHash: fcEvent.UnsafeL2Head.Hash,
SafeBlockHash: fcEvent.SafeL2Head.Hash,
FinalizedBlockHash: fcEvent.FinalizedL2Head.Hash,
}
//fc := eth.ForkchoiceState{
// HeadBlockHash: fcEvent.UnsafeL2Head.Hash,
// SafeBlockHash: fcEvent.SafeL2Head.Hash,
// FinalizedBlockHash: fcEvent.FinalizedL2Head.Hash,
//}
buildStartTime := time.Now()
result, err := startPayload(context.TODO(), eq.ec.engine, fc, ev.Attributes.Attributes)
if err != nil {
......
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