Skip to content

Commit

Permalink
fix: better handling of collateral UTxOs in indexer
Browse files Browse the repository at this point in the history
This also bumps the mint ExUnits estimated value
  • Loading branch information
agaffney committed May 3, 2024
1 parent 8351cf3 commit 3c8a09c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/Salvionied/apollo v1.0.11
github.com/blinklabs-io/bursa v0.7.1
github.com/blinklabs-io/cardano-models v0.3.2
github.com/blinklabs-io/gouroboros v0.80.0
github.com/blinklabs-io/snek v0.17.4
github.com/blinklabs-io/gouroboros v0.82.0
github.com/blinklabs-io/snek v0.18.0
github.com/dgraph-io/badger/v4 v4.2.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/minio/sha256-simd v1.0.1
Expand Down Expand Up @@ -53,7 +53,7 @@ require (
github.com/leodido/go-urn v1.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/utxorpc/go-codegen v0.5.0 // indirect
github.com/utxorpc/go-codegen v0.5.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opencensus.io v0.22.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ github.com/blinklabs-io/bursa v0.7.1 h1:RJ22jtpz1Qa8vYUV8X8svx0k13rcFFksXLibWxN7
github.com/blinklabs-io/bursa v0.7.1/go.mod h1:CeHkFk0gtTEbYaYvnos5TDhxAOPqkwE2Ja8nwqLKuDw=
github.com/blinklabs-io/cardano-models v0.3.2 h1:3kH0sy/HhL0U2Go9yrlAlDzoT9BhjKExxzWFmoWUAxQ=
github.com/blinklabs-io/cardano-models v0.3.2/go.mod h1:SV1SDNjwJ+Oq3qu7uGgEXeRnE+fNWgKBgSBY80gfIJI=
github.com/blinklabs-io/gouroboros v0.80.0 h1:0XWo0+yjzOPXAR2YTE7De0gkuQvdKonP7VnQ6lNlVyA=
github.com/blinklabs-io/gouroboros v0.80.0/go.mod h1:NeIpkG7GJOa/BW10596tysY8K3gcHt2BSnCss3fNMXU=
github.com/blinklabs-io/gouroboros v0.82.0 h1:bakuadyu8b9Rr7MX9WgZy3wgiopdZhoA7x8s1Rqnua0=
github.com/blinklabs-io/gouroboros v0.82.0/go.mod h1:uBExUfgZvhPqiur3N9ReoXv4LpqGmR9jSZjolr1nZ2w=
github.com/blinklabs-io/ouroboros-mock v0.3.0 h1:6VRWyhAv0k7nQEgzFpuqhS/n8OM+OAaLN/sCT5K2Hbc=
github.com/blinklabs-io/ouroboros-mock v0.3.0/go.mod h1:0dzTNEk/Kvqa7qYHDy7/Nn3OTt+EOosMknB37FRzI1k=
github.com/blinklabs-io/snek v0.17.4 h1:/BoWqfJTZXSQsRkVRS3tLFhlrvjme82Xu6jYkEBtMJ4=
github.com/blinklabs-io/snek v0.17.4/go.mod h1:EeH+8u94Jekws0WnDAKY4SeHD0ftp/t1UixLcu9qSts=
github.com/blinklabs-io/snek v0.18.0 h1:uiitNw03EWCBaGGknZ3EQ3RDEvHcwF67t+DgBWCmdJw=
github.com/blinklabs-io/snek v0.18.0/go.mod h1:71WM+abhoErwwFsjdLUwQ9BfVva5u5RKzu3vJWhUA9w=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
Expand Down Expand Up @@ -114,8 +114,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
github.com/utxorpc/go-codegen v0.5.0 h1:uNl4E91yQLzl2JI43k/f62+3JfbiKvHb1BDKzBMzzBk=
github.com/utxorpc/go-codegen v0.5.0/go.mod h1:T7BTBMwlLpw41JM8p5KtqT45TvmWDG9ad7PvV00qOQQ=
github.com/utxorpc/go-codegen v0.5.1 h1:Xhq3CdWAQEJgi46Naq7epeO4G5EyGApP38yNxMCqCbY=
github.com/utxorpc/go-codegen v0.5.1/go.mod h1:sEfglXN19j3cq0qQvb2NS4IcxUSrK1crYXbsVf11SGM=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
4 changes: 2 additions & 2 deletions internal/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ func (i *Indexer) handleEvent(evt event.Event) error {
eventTx := evt.Payload.(input_chainsync.TransactionEvent)
eventCtx := evt.Context.(input_chainsync.TransactionContext)
// Delete used UTXOs
for _, txInput := range eventTx.Inputs {
for _, txInput := range eventTx.Transaction.Consumed() {
// We don't have a ledger DB to know where the TX inputs came from, so we just try deleting them for our known addresses
for _, tmpAddress := range []string{cfg.Indexer.ScriptAddress, wallet.GetWallet().PaymentAddress} {
if err := storage.GetStorage().RemoveUtxo(tmpAddress, txInput.Id().String(), txInput.Index()); err != nil {
return err
}
}
}
for idx, txOutput := range eventTx.Outputs {
for idx, txOutput := range eventTx.Transaction.Produced() {
// Write UTXO to storage
if err := storage.GetStorage().AddUtxo(
txOutput.Address().String(),
Expand Down
2 changes: 1 addition & 1 deletion internal/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func createTx(blockData any, nonce [16]byte) ([]byte, error) {
Index: 0,
// NOTE: these values are estimated
ExUnits: Redeemer.ExecutionUnits{
Mem: 60_000,
Mem: 80_000,
Steps: 30_000_000,
},
Data: PlutusData.PlutusData{
Expand Down

0 comments on commit 3c8a09c

Please sign in to comment.