Skip to content

Commit

Permalink
updates based on latests ocr2vrf changes; extend integration test to … (
Browse files Browse the repository at this point in the history
smartcontractkit#9133)

Co-authored-by: Makram Kamaleddine <[email protected]>
  • Loading branch information
jinhoonbang and makramkd authored May 10, 2023
1 parent 2ee7157 commit 4c35f3f
Show file tree
Hide file tree
Showing 28 changed files with 1,550 additions and 3,215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ ROOT="$(
cd ../../ && pwd -P
)"

solc-select use 0.8.15
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs 1000 --metadata-hash none \
-o $ROOT/contracts/solc/v0.8.15 \
solc-select use 0.8.19
# Optionally set optimize runs from arguments (default = 1000)
OPTIMIZE_RUNS="${3}"

solc-select use 0.8.19
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v0.8.19 \
--abi --bin \
--allow-paths $ROOT/contracts/src/v0.8,$ROOT/../$2/contracts,$ROOT/contracts/src/v0.8/dev,$ROOT/contracts/src/v0.8/interfaces,$ROOT/contracts/src/v0.8/mocks,$ROOT/contracts/src/v0.8/tests,$ROOT/contracts/src/v0.8/vendor,$ROOT/contracts/node_modules/.pnpm/@[email protected]/node_modules/@openzeppelin/contracts,$ROOT/contracts/node_modules/.pnpm/@[email protected]/node_modules/@openzeppelin/contracts-upgradeable \
$ROOT/contracts/src/v0.8/$1
14 changes: 7 additions & 7 deletions contracts/scripts/native_solc_compile_all_ocr2vrf
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ set -e
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
echo $SCRIPTPATH
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
solc-select install 0.8.15
solc-select install 0.8.19

## Change me.
FOLDER="ocr2vrf-origin"

# OCR2VRF
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/DKG.sol $FOLDER
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFBeacon.sol $FOLDER
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFCoordinator.sol $FOLDER
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFRouter.sol $FOLDER
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/test/TestBeaconVRFConsumer.sol $FOLDER
$SCRIPTPATH/native_solc8_15_compile_ocr2vrf ../../../../$FOLDER/contracts/test/LoadTestBeaconVRFConsumer.sol $FOLDER
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/DKG.sol $FOLDER 1000
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFBeacon.sol $FOLDER 1000
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFCoordinator.sol $FOLDER 100
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/VRFRouter.sol $FOLDER 1000
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/test/TestBeaconVRFConsumer.sol $FOLDER 1000
$SCRIPTPATH/native_solc8_19_compile_ocr2vrf ../../../../$FOLDER/contracts/test/LoadTestBeaconVRFConsumer.sol $FOLDER 1000
2 changes: 1 addition & 1 deletion core/gethwrappers/ocr2vrf/generated/dkg/dkg.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

161 changes: 156 additions & 5 deletions core/gethwrappers/ocr2vrf/generated/vrf_beacon/vrf_beacon.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

582 changes: 476 additions & 106 deletions core/gethwrappers/ocr2vrf/generated/vrf_coordinator/vrf_coordinator.go

Large diffs are not rendered by default.

1,302 changes: 222 additions & 1,080 deletions core/gethwrappers/ocr2vrf/generated/vrf_router/vrf_router.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GETH_VERSION: 1.11.5
dkg: ../../../contracts/solc/v0.8.15/DKG.abi ../../../contracts/solc/v0.8.15/DKG.bin 6a2ddc10830a4144dd1907a5c856eb51cb30279b83418cd6e273707947ec3b0c
load_test_beacon_consumer: ../../../contracts/solc/v0.8.15/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.15/LoadTestBeaconVRFConsumer.bin dda038753df8147b234d526607ef889a20cfc6a3b409e1b86fc93b753179df4e
vrf_beacon: ../../../contracts/solc/v0.8.15/VRFBeacon.abi ../../../contracts/solc/v0.8.15/VRFBeacon.bin 793e303d341235054be3f471770008889d15d6ede788bc465855afb121485608
vrf_beacon_consumer: ../../../contracts/solc/v0.8.15/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.15/BeaconVRFConsumer.bin be5ef94c278abca5f9332bc18ecbd7e69c7ef7f03a8fe0727358411c3ed57f56
dkg: ../../../contracts/solc/v0.8.19/DKG.abi ../../../contracts/solc/v0.8.19/DKG.bin f67f628c5af590c898d46789e5500f36d3b0eca442e66a334968776c6fc9b4ed
load_test_beacon_consumer: ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.bin 4376386cfcf0e7de085e2c4e7687478b5388f193e933265a04bf9d07fd22953f
vrf_beacon: ../../../contracts/solc/v0.8.19/VRFBeacon.abi ../../../contracts/solc/v0.8.19/VRFBeacon.bin 482c42567b01bedbc7c926b1b1edde0634b2e96be43d86a9a7d3412984dd5119
vrf_beacon_consumer: ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.bin 1e61069819a6dc054133cd7b7c9ec6d7871b8fe8390cde7d16272a01cb8f8a07
vrf_beacon_coordinator: ../../../contracts/solc/v0.8.15/VRFBeaconCoordinator.abi ../../../contracts/solc/v0.8.15/VRFBeaconCoordinator.bin 08da747a3488fcd318ddc0db75fd0df7c07a100b2e19061f0efcb12a7180ecde
vrf_coordinator: ../../../contracts/solc/v0.8.15/VRFCoordinator.abi ../../../contracts/solc/v0.8.15/VRFCoordinator.bin 8190f4080a793fe4a95b3aa6ae9a74b8919068b4d68d777c601b6b668aa246cc
vrf_router: ../../../contracts/solc/v0.8.15/VRFRouter.abi ../../../contracts/solc/v0.8.15/VRFRouter.bin 9554d5e4c157e07a86430b5efb22df50a6ef3eb7dea7cb72cde8a1baa5e0b201
vrf_coordinator: ../../../contracts/solc/v0.8.19/VRFCoordinator.abi ../../../contracts/solc/v0.8.19/VRFCoordinator.bin 7f5f081ed03f8243200085bd4afc6545074198aeba93a445a41f2d6ad17559b6
vrf_router: ../../../contracts/solc/v0.8.19/VRFRouter.abi ../../../contracts/solc/v0.8.19/VRFRouter.bin 3d5bac8144deb9770d4b7cd70dc88d5583fa986acf1d3823c01f5b8305e35670
12 changes: 6 additions & 6 deletions core/gethwrappers/ocr2vrf/go_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
package gethwrappers

// OCR2VRF - remove the _disabled tag to run these locally.
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/DKG.abi ../../../contracts/solc/v0.8.15/DKG.bin DKG dkg
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/VRFCoordinator.abi ../../../contracts/solc/v0.8.15/VRFCoordinator.bin VRFCoordinator vrf_coordinator
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/VRFBeacon.abi ../../../contracts/solc/v0.8.15/VRFBeacon.bin VRFBeacon vrf_beacon
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/VRFRouter.abi ../../../contracts/solc/v0.8.15/VRFRouter.bin VRFRouter vrf_router
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.15/BeaconVRFConsumer.bin BeaconVRFConsumer vrf_beacon_consumer
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.15/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.15/LoadTestBeaconVRFConsumer.bin LoadTestBeaconVRFConsumer load_test_beacon_consumer
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/DKG.abi ../../../contracts/solc/v0.8.19/DKG.bin DKG dkg
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/VRFCoordinator.abi ../../../contracts/solc/v0.8.19/VRFCoordinator.bin VRFCoordinator vrf_coordinator
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/VRFBeacon.abi ../../../contracts/solc/v0.8.19/VRFBeacon.bin VRFBeacon vrf_beacon
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/VRFRouter.abi ../../../contracts/solc/v0.8.19/VRFRouter.bin VRFRouter vrf_router
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/BeaconVRFConsumer.bin BeaconVRFConsumer vrf_beacon_consumer
//go:generate_disabled go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.abi ../../../contracts/solc/v0.8.19/LoadTestBeaconVRFConsumer.bin LoadTestBeaconVRFConsumer load_test_beacon_consumer
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20230413082317-9561d14087cc
github.com/smartcontractkit/ocr2keepers v0.6.14
github.com/smartcontractkit/ocr2vrf v0.0.0-20230501212125-88509cd4bc03
github.com/smartcontractkit/ocr2vrf v0.0.0-20230510102715-c58be582bf19
github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb
github.com/spf13/cobra v1.6.0
github.com/spf13/viper v1.14.0
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1374,8 +1374,8 @@ github.com/smartcontractkit/libocr v0.0.0-20230413082317-9561d14087cc h1:aSCDAai
github.com/smartcontractkit/libocr v0.0.0-20230413082317-9561d14087cc/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw=
github.com/smartcontractkit/ocr2keepers v0.6.14 h1:Rg+SYd8PCyd4CcCetwnRKjVEQsHVsV6QOaWcLhi+6sg=
github.com/smartcontractkit/ocr2keepers v0.6.14/go.mod h1:gqIksJFzdXFsHfGdCWm1uTxbwvAltgcwcaqIgAStC1A=
github.com/smartcontractkit/ocr2vrf v0.0.0-20230501212125-88509cd4bc03 h1:cR+698TzpJrsYoud0nT5f4SqdAyPzd0+6mBi8isE5Tk=
github.com/smartcontractkit/ocr2vrf v0.0.0-20230501212125-88509cd4bc03/go.mod h1:ItRUsD9uTAMB7uBCAxxIzUE14KgsGpWvTuJiErMNMlQ=
github.com/smartcontractkit/ocr2vrf v0.0.0-20230510102715-c58be582bf19 h1:RxaC+V34UEP2u/riXfcvWPZEglri4UsfQi5joUObZ08=
github.com/smartcontractkit/ocr2vrf v0.0.0-20230510102715-c58be582bf19/go.mod h1:AZbOisIoA3cOUku8suZ+KWBnzbRiafmhi7UKiXoezrk=
github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb h1:OMaBUb4X9IFPLbGbCHsMU+kw/BPCrewaVwWGIBc0I4A=
github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb/go.mod h1:HNUu4cJekUdsJbwRBCiOybtkPJEfGRELQPe2tkoDEyk=
github.com/smartcontractkit/wsrpc v0.6.2-0.20230317160629-382a1ac921d8 h1:Wn9X8mOQoQzzh1kBK22EDDgyXAfVjDlFlqUQW5kyyGo=
Expand Down
9 changes: 7 additions & 2 deletions core/scripts/ocr2vrf/setup_ocr2vrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ func setupOCR2VRFNodes(e helpers.Environment) {
weiPerUnitLink := fs.String("wei-per-unit-link", "6e16", "wei per unit link price for feed")
beaconPeriodBlocks := fs.Int64("beacon-period-blocks", 3, "beacon period in blocks")
subscriptionBalanceString := fs.String("subscription-balance", "1e19", "amount to fund subscription")
maxCallbackGasLimit := fs.Uint("max-cb-gas-limit", 2.5e6, "max callback gas limit")
maxCallbackArgumentsLength := fs.Uint("max-cb-args-length", 32*10 /* 10 EVM words */, "max callback arguments length")

apiFile := fs.String("api", "../../../tools/secrets/apicredentials", "api credentials file")
passwordFile := fs.String("password", "../../../tools/secrets/password.txt", "password file")
Expand Down Expand Up @@ -90,7 +92,10 @@ func setupOCR2VRFNodes(e helpers.Environment) {
vrfRouterAddress := deployVRFRouter(e)

fmt.Println("Deploying VRF coordinator...")
vrfCoordinatorAddress := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String(), vrfRouterAddress.String())
vrfCoordinatorAddress, vrfCoordinator := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String(), vrfRouterAddress.String())

fmt.Println("Configuring VRF coordinator...")
configureVRFCoordinator(e, vrfCoordinator, uint32(*maxCallbackGasLimit), uint32(*maxCallbackArgumentsLength))

fmt.Println("Registering VRF coordinator...")
registerCoordinator(e, vrfRouterAddress.String(), vrfCoordinatorAddress.String())
Expand Down Expand Up @@ -335,7 +340,7 @@ func setupOCR2VRFNodesForInfraWithForwarder(e helpers.Environment) {
vrfRouterAddress := deployVRFRouter(e)

fmt.Println("Deploying VRF coordinator...")
vrfCoordinatorAddress := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String(), vrfRouterAddress.String())
vrfCoordinatorAddress, _ := deployVRFCoordinator(e, big.NewInt(*beaconPeriodBlocks), link.String(), feedAddress.String(), vrfRouterAddress.String())

fmt.Println("Registering VRF coordinator...")
registerCoordinator(e, vrfRouterAddress.String(), vrfCoordinatorAddress.String())
Expand Down
16 changes: 13 additions & 3 deletions core/scripts/ocr2vrf/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
gethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/smartcontractkit/libocr/offchainreporting2/confighelper"
"github.com/smartcontractkit/libocr/offchainreporting2/types"
Expand Down Expand Up @@ -56,8 +57,8 @@ func deployVRFRouter(e helpers.Environment) common.Address {
return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID)
}

func deployVRFCoordinator(e helpers.Environment, beaconPeriodBlocks *big.Int, linkAddress, linkEthFeed, router string) common.Address {
_, tx, _, err := vrf_coordinator.DeployVRFCoordinator(
func deployVRFCoordinator(e helpers.Environment, beaconPeriodBlocks *big.Int, linkAddress, linkEthFeed, router string) (common.Address, *vrf_coordinator.VRFCoordinator) {
_, tx, coordinator, err := vrf_coordinator.DeployVRFCoordinator(
e.Owner,
e.Ec,
beaconPeriodBlocks,
Expand All @@ -66,7 +67,16 @@ func deployVRFCoordinator(e helpers.Environment, beaconPeriodBlocks *big.Int, li
common.HexToAddress(router),
)
helpers.PanicErr(err)
return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID)
return helpers.ConfirmContractDeployed(context.Background(), e.Ec, tx, e.ChainID), coordinator
}

func configureVRFCoordinator(e helpers.Environment, coordinator *vrf_coordinator.VRFCoordinator, maxCbGasLimit, maxCbArgsLen uint32) *gethtypes.Receipt {
tx, err := coordinator.SetConfig(e.Owner, vrf_coordinator.VRFCoordinatorConfig{
MaxCallbackGasLimit: maxCbGasLimit,
MaxCallbackArgumentsLength: maxCbArgsLen,
})
helpers.PanicErr(err)
return helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID, "vrf coordinator setConfig")
}

func deployAuthorizedForwarder(e helpers.Environment, link common.Address, owner common.Address) common.Address {
Expand Down
3 changes: 1 addition & 2 deletions core/scripts/vrfv1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ func main() {
pk, err := crypto.UnmarshalPubkey(pubBytes)
helpers.PanicErr(err)

uid, err := uuid.FromString(*jobID)
helpers.PanicErr(err)
uid := uuid.MustParse(*jobID)
tx, err := coordinator.RegisterProvingKey(
e.Owner,
decimal.RequireFromString(*fee).BigInt(),
Expand Down
16 changes: 8 additions & 8 deletions core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type blockInReport struct {

type callback struct {
blockNumber uint64
requestID uint64
requestID *big.Int
}

type callbackInReport struct {
Expand Down Expand Up @@ -455,7 +455,7 @@ func (c *coordinator) ReportBlocks(

// Pull request IDs from elligible callbacks for logging. There should only be
// at most 100-200 elligible callbacks in a report.
var reqIDs []uint64
var reqIDs []*big.Int
for _, c := range callbacks {
reqIDs = append(reqIDs, c.RequestID)
}
Expand Down Expand Up @@ -495,7 +495,7 @@ func (c *coordinator) getBlockhashesMappingFromRequests(

// Also get the blockhash for the most recent cached report on this callback,
// if one exists.
cacheKey := getCallbackCacheKey(l.RequestID.Int64())
cacheKey := getCallbackCacheKey(l.RequestID)
t := c.toBeTransmittedCallbacks.GetItem(cacheKey)
if t != nil {
rawBlocksRequested[t.recentBlockHeight] = struct{}{}
Expand Down Expand Up @@ -632,7 +632,7 @@ func (c *coordinator) filterUnfulfilledCallbacks(
ConfirmationDelay: uint32(r.ConfDelay.Uint64()),
SubscriptionID: r.SubID,
Price: big.NewInt(0), // TODO: no price tracking
RequestID: requestID.Uint64(),
RequestID: requestID,
NumWords: r.NumWords,
Requester: r.Requester,
Arguments: r.Arguments,
Expand Down Expand Up @@ -671,7 +671,7 @@ func (c *coordinator) filterEligibleCallbacks(

// Check that the callback is elligible.
if isBlockEligible(r.NextBeaconOutputHeight, r.ConfDelay, currentHeight) {
cacheKey := getCallbackCacheKey(r.RequestID.Int64())
cacheKey := getCallbackCacheKey(r.RequestID)
t := c.toBeTransmittedCallbacks.GetItem(cacheKey)
// If the callback is found in the cache and the recentBlockHash from the report containing the callback
// is correct, then the callback is in-flight and should not be included in the current observation. If that
Expand Down Expand Up @@ -886,7 +886,7 @@ func (c *coordinator) ReportWillBeTransmitted(ctx context.Context, report ocr2vr

// Add the corresponding blockhashes to callbacks and mark them as transmitted.
for _, cb := range callbacksRequested {
cacheKey := getCallbackCacheKey(int64(cb.requestID))
cacheKey := getCallbackCacheKey(cb.requestID)
c.toBeTransmittedCallbacks.CacheItem(cb, cacheKey, now)
c.lggr.Debugw("Request is being transmitted", "requestID", cb.requestID)
}
Expand Down Expand Up @@ -1055,8 +1055,8 @@ func getBlockCacheKey(blockNumber uint64, confDelay uint64) common.Hash {
// The blockhash of the callback does not need to be included in the key. Instead,
// the callback cached at a given key contains a blockhash that is checked for validity
// against the log poller's current state.
func getCallbackCacheKey(requestID int64) common.Hash {
return common.BigToHash(big.NewInt(requestID))
func getCallbackCacheKey(requestID *big.Int) common.Hash {
return common.BigToHash(requestID)
}

// logAndEmitFunctionDuration logs the time in milliseconds and emits metrics in nanosecond for function duration
Expand Down
17 changes: 10 additions & 7 deletions core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ func TestCoordinator_ReportBlocks(t *testing.T) {
ConfirmationDelay: 195,
Callbacks: []ocr2vrftypes.AbstractCostedCallbackRequest{
{
RequestID: 1,
RequestID: big.NewInt(1),
BeaconHeight: 195,
},
{
RequestID: 2,
RequestID: big.NewInt(2),
BeaconHeight: 195,
},
{
RequestID: 3,
RequestID: big.NewInt(3),
BeaconHeight: 195,
},
},
Expand Down Expand Up @@ -1456,6 +1456,7 @@ func newRandomnessRequestedLog(
NextBeaconOutputHeight: nextBeaconOutputHeight,
NumWords: 1,
SubID: big.NewInt(1),
CostJuels: big.NewInt(50_000),
Raw: types.Log{
BlockNumber: requestBlock,
},
Expand All @@ -1466,7 +1467,7 @@ func newRandomnessRequestedLog(
unindexed = append(unindexed, a)
}
}
nonIndexedData, err := unindexed.Pack(e.NextBeaconOutputHeight, e.ConfDelay, e.SubID, e.NumWords)
nonIndexedData, err := unindexed.Pack(e.NextBeaconOutputHeight, e.ConfDelay, e.SubID, e.NumWords, e.CostJuels)
require.NoError(t, err)

requestIDType, err := abi.NewType("uint64", "", nil)
Expand Down Expand Up @@ -1523,12 +1524,13 @@ func newRandomnessFulfillmentRequestedLog(
// address indexed requester,
// uint64 nextBeaconOutputHeight,
// ConfirmationDelay confDelay,
// uint64 subID,
// uint256 subID,
// uint16 numWords,
// uint32 gasAllowance,
// uint256 gasPrice,
// uint256 weiPerUnitLink,
// bytes arguments
// bytes arguments,
// uint256 costJuels
//);
e := vrf_coordinator.VRFCoordinatorRandomnessFulfillmentRequested{
ConfDelay: big.NewInt(confDelay),
Expand All @@ -1540,6 +1542,7 @@ func newRandomnessFulfillmentRequestedLog(
WeiPerUnitLink: big.NewInt(0),
SubID: big.NewInt(1),
Requester: common.HexToAddress("0x1234567890"),
CostJuels: big.NewInt(50_000),
Raw: types.Log{
BlockNumber: requestBlock,
},
Expand All @@ -1551,7 +1554,7 @@ func newRandomnessFulfillmentRequestedLog(
}
}
nonIndexedData, err := unindexed.Pack(e.NextBeaconOutputHeight, e.ConfDelay, e.SubID, e.NumWords,
e.GasAllowance, e.GasPrice, e.WeiPerUnitLink, e.Arguments)
e.GasAllowance, e.GasPrice, e.WeiPerUnitLink, e.Arguments, e.CostJuels)
require.NoError(t, err)

requestIDType, err := abi.NewType("uint64", "", nil)
Expand Down
Loading

0 comments on commit 4c35f3f

Please sign in to comment.