-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
horizon/ingest: support parsing of new InvokeHostFunction op #4608
Changes from all commits
b2c0839
573c58e
68e6901
4eec6b3
6862e0f
6fe1050
f14838f
4224628
564a43f
101dc29
940db2e
1bd8f14
aaff28c
7e880f2
180405a
badfe1a
1315f39
68a1d74
3a4d1b9
f8637aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,19 @@ func submitPaymentOps(itest *integration.Test, tt *assert.Assertions) (submitted | |
return ops, txResp.Ledger | ||
} | ||
|
||
func submitInvokeHostFunction(itest *integration.Test, tt *assert.Assertions) (submittedOperations []txnbuild.Operation, lastLedger int32) { | ||
ops := []txnbuild.Operation{ | ||
&txnbuild.InvokeHostFunction{ | ||
Function: xdr.HostFunctionHostFnCall, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these values be populated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this test coverage, success/fail of tx was not scope for assertion, rather, it's just the presence of the InvokeHostFunction xdr going through ingest, so tried to avoid further complexity on that. |
||
Footprint: xdr.LedgerFootprint{}, | ||
Parameters: xdr.ScVec{}, | ||
}, | ||
} | ||
txResp, _ := itest.SubmitOperations(itest.MasterAccount(), itest.Master(), ops...) | ||
|
||
return ops, txResp.Ledger | ||
} | ||
|
||
func submitSponsorshipOps(itest *integration.Test, tt *assert.Assertions) (submittedOperations []txnbuild.Operation, lastLedger int32) { | ||
keys, accounts := itest.CreateAccounts(1, "1000") | ||
sponsor, sponsorPair := accounts[0], keys[0] | ||
|
@@ -400,6 +413,12 @@ func initializeDBIntegrationTest(t *testing.T) (itest *integration.Test, reached | |
itest = integration.NewTest(t, integration.Config{}) | ||
tt := assert.New(t) | ||
|
||
// Make sure all possible operations are covered by reingestion | ||
allOpTypes := set.Set[xdr.OperationType]{} | ||
for typ := range xdr.OperationTypeToStringMap { | ||
allOpTypes.Add(xdr.OperationType(typ)) | ||
} | ||
|
||
// submit all possible operations | ||
ops, _ := submitAccountOps(itest, tt) | ||
submittedOps := ops | ||
|
@@ -415,16 +434,15 @@ func initializeDBIntegrationTest(t *testing.T) (itest *integration.Test, reached | |
submittedOps = append(submittedOps, ops...) | ||
ops, reachedLedger = submitLiquidityPoolOps(itest, tt) | ||
submittedOps = append(submittedOps, ops...) | ||
|
||
// Make sure all possible operations are covered by reingestion | ||
allOpTypes := set.Set[xdr.OperationType]{} | ||
for typ := range xdr.OperationTypeToStringMap { | ||
allOpTypes.Add(xdr.OperationType(typ)) | ||
if integration.GetCoreMaxSupportedProtocol() > 19 { | ||
ops, _ = submitInvokeHostFunction(itest, tt) | ||
submittedOps = append(submittedOps, ops...) | ||
} else { | ||
delete(allOpTypes, xdr.OperationTypeInvokeHostFunction) | ||
} | ||
|
||
// Inflation is not supported | ||
delete(allOpTypes, xdr.OperationTypeInflation) | ||
// TODO: | ||
delete(allOpTypes, xdr.OperationTypeInvokeHostFunction) | ||
|
||
for _, op := range submittedOps { | ||
opXDR, err := op.BuildXDR() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any case where we want to add a serializedParam here that doesn't have a value ?
i.e. that's what going to happen in case
MarshalBinary
would return an error.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there shouldn't be based on type safety of the gen'd xdr structs, but rather than ignore the runtime serialization error
in any case, I've done some conservative err handling and test coverage of that exceptional case of a malformed param - 68a1d74