Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
test: update encoding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Oct 1, 2023
1 parent d66a268 commit 4c24265
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bindings/encoding/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
Components: []abi.ArgumentMarshaling{
{
Name: "tier",
Type: "uint64",
Type: "uint16",
},
{
Name: "fee",
Expand Down
4 changes: 2 additions & 2 deletions bindings/encoding/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestEncodeEvidence(t *testing.T) {
SignalRoot: randomHash(),
Graffiti: randomHash(),
Tier: uint16(rand.Uint64()),
Proofs: randomHash().Big().Bytes(),
Proof: randomHash().Big().Bytes(),
}

b, err := EncodeEvidence(evidence)
Expand All @@ -32,7 +32,7 @@ func TestEncodeProverAssignment(t *testing.T) {
&ProverAssignment{
Prover: common.BigToAddress(new(big.Int).SetUint64(rand.Uint64())),
FeeToken: common.Address{},
TierFees: []*TierFee{},
TierFees: []TierFee{{Tier: 0, Fee: common.Big1}},
Signature: randomHash().Big().Bytes(),
Expiry: 1024,
},
Expand Down
4 changes: 2 additions & 2 deletions bindings/encoding/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type BlockEvidence struct {
SignalRoot [32]byte
Graffiti [32]byte
Tier uint16
Proofs []byte
Proof []byte
}

// TierFee should be same with TaikoData.TierFee.
Expand All @@ -49,7 +49,7 @@ type TierFee struct {
type ProverAssignment struct {
Prover common.Address
FeeToken common.Address
TierFees []*TierFee
TierFees []TierFee
Expiry uint64
Signature []byte
}
Expand Down
2 changes: 1 addition & 1 deletion proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func (p *Proposer) ProposeTxList(
&encoding.ProverAssignment{
Prover: prover,
FeeToken: common.Address{},
TierFees: []*encoding.TierFee{}, // TODO: update tier fees
TierFees: []encoding.TierFee{}, // TODO: update tier fees
Expiry: uint64(proverAssignmentTimeout.Seconds()),
Signature: signature,
},
Expand Down
2 changes: 1 addition & 1 deletion proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *ProposerTestSuite) TestSendProposeBlockTx() {
&encoding.ProverAssignment{
Prover: prover,
FeeToken: common.Address{},
TierFees: []*encoding.TierFee{},
TierFees: []encoding.TierFee{},
Expiry: uint64(proverAssignmentTimeout.Seconds()),
Signature: signature,
},
Expand Down
2 changes: 1 addition & 1 deletion proposer/prover_selector/eth_fee_eoa_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func assignProver(
encoded, err := encoding.EncodeProverAssignment(&encoding.ProverAssignment{
Prover: result.Prover,
FeeToken: common.Address{},
TierFees: []*encoding.TierFee{}, // TODO: update tier fees
TierFees: []encoding.TierFee{}, // TODO: update tier fees
Expiry: reqBody.Expiry,
Signature: result.SignedPayload,
})
Expand Down
4 changes: 2 additions & 2 deletions prover/proof_submitter/valid_proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ func (s *ValidProofSubmitter) SubmitProof(
SignalRoot: proofWithHeader.Opts.SignalRoot,
Graffiti: s.graffiti,
Tier: 0, // TODO: update tier
Proofs: zkProof,
Proof: zkProof,
}

circuitsIdx, err := proofProducer.DegreeToCircuitsIdx(proofWithHeader.Degree)
if err != nil {
return err
}
evidence.Proofs = append(uint16ToBytes(circuitsIdx), evidence.Proofs...)
evidence.Proof = append(uint16ToBytes(circuitsIdx), evidence.Proof...)

input, err := encoding.EncodeEvidence(evidence)
if err != nil {
Expand Down
9 changes: 2 additions & 7 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,16 +461,11 @@ func (p *Prover) onBlockProposed(
p.cancelProof(ctx, event.Meta.Id)
}

block, err := p.rpc.TaikoL1.GetBlock(&bind.CallOpts{Context: ctx}, event.BlockId.Uint64())
if err != nil {
return err
}

log.Info(
"Proposed block information",
"blockID", event.BlockId,
"assignedProver", block.AssignedProver,
"proposedAt", block.ProposedAt,
"assignedProver", event.AssignedProver,
"minTier", event.MinTier,
)

// TODO: add this back
Expand Down

0 comments on commit 4c24265

Please sign in to comment.