Skip to content
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

Bump the all-dependencies group with 2 updates #134

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions explorer/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate) []Event {
fces := make(map[types.FileContractID]types.FileContractElement)
v2fces := make(map[types.FileContractID]types.V2FileContractElement)
cu.ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool) {
sce.MerkleProof = nil
sce.StateElement.MerkleProof = nil
sces[types.SiacoinOutputID(sce.ID)] = sce
ChrisSchinnerl marked this conversation as resolved.
Show resolved Hide resolved
})
cu.ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool) {
sfe.MerkleProof = nil
sfe.StateElement.MerkleProof = nil
sfes[types.SiafundOutputID(sfe.ID)] = sfe
})
cu.ForEachFileContractElement(func(fce types.FileContractElement, created bool, rev *types.FileContractElement, resolved, valid bool) {
fce.MerkleProof = nil
fce.StateElement.MerkleProof = nil
fces[types.FileContractID(fce.ID)] = fce
})
cu.ForEachV2FileContractElement(func(fce types.V2FileContractElement, created bool, rev *types.V2FileContractElement, res types.V2FileContractResolutionType) {
fce.MerkleProof = nil
fce.StateElement.MerkleProof = nil
v2fces[types.FileContractID(fce.ID)] = fce
})

Expand Down Expand Up @@ -220,7 +220,7 @@ func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate) []Event {
var e EventV2Transaction
for _, a := range txn.Attestations {
var ha chain.HostAnnouncement
if ha.FromAttestation(a) {
if ha.FromArbitraryData(a.Value) {
ChrisSchinnerl marked this conversation as resolved.
Show resolved Hide resolved
e.HostAnnouncements = append(e.HostAnnouncements, ha)
}
}
Expand Down
6 changes: 3 additions & 3 deletions explorer/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ func applyChainUpdate(tx UpdateTx, cau chain.ApplyUpdate) error {
if created && spent {
ephemeralSiacoinElements = append(ephemeralSiacoinElements, SiacoinOutput{
SiacoinElement: se,
Source: sources[types.SiacoinOutputID(se.StateElement.ID)],
Source: sources[types.SiacoinOutputID(se.ID)],
ChrisSchinnerl marked this conversation as resolved.
Show resolved Hide resolved
})
return
}

if spent {
spentSiacoinElements = append(spentSiacoinElements, SiacoinOutput{
SiacoinElement: se,
Source: sources[types.SiacoinOutputID(se.StateElement.ID)],
Source: sources[types.SiacoinOutputID(se.ID)],
})
} else {
newSiacoinElements = append(newSiacoinElements, SiacoinOutput{
SiacoinElement: se,
Source: sources[types.SiacoinOutputID(se.StateElement.ID)],
Source: sources[types.SiacoinOutputID(se.ID)],
})
}
})
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ go 1.23.1
toolchain go1.23.2

require (
github.com/ip2location/ip2location-go v8.3.0+incompatible
github.com/mattn/go-sqlite3 v1.14.24
go.sia.tech/core v0.5.0
go.sia.tech/coreutils v0.5.0
go.sia.tech/core v0.6.1
go.sia.tech/coreutils v0.6.0
go.sia.tech/jape v0.12.1
go.uber.org/zap v1.27.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -16,7 +17,6 @@ require (
)

require (
github.com/ip2location/ip2location-go v8.3.0+incompatible // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gt
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
go.sia.tech/core v0.5.0 h1:feLC7DSCF+PhU157s/94106hFKyiGrGQ9HC3/dF/l7E=
go.sia.tech/core v0.5.0/go.mod h1:P3C1BWa/7J4XgdzWuaYHBvLo2RzZ0UBaJM4TG1GWB2g=
go.sia.tech/coreutils v0.5.0 h1:/xKxdw83iZy0jjLzI2NGHyG4azyjK5DJscxpkr6nIGQ=
go.sia.tech/coreutils v0.5.0/go.mod h1:VYM4FcmlhVrpDGvglLHjRW+gitoaxPNLvp5mL2quilo=
go.sia.tech/core v0.6.1 h1:eaExM2E2eNr43su2XDkY5J24E3F54YGS7hcC3WtVjVk=
go.sia.tech/core v0.6.1/go.mod h1:P3C1BWa/7J4XgdzWuaYHBvLo2RzZ0UBaJM4TG1GWB2g=
go.sia.tech/coreutils v0.6.0 h1:r0IZt+aVdGG2uIHl7OtaWRYdVx4NQ7ezRoSGa0Ej8GY=
go.sia.tech/coreutils v0.6.0/go.mod h1:XlsnogeYU/Tdjzp/HUNAj5T7tZCdmeBHIBjymbPC+uQ=
go.sia.tech/jape v0.12.1 h1:xr+o9V8FO8ScRqbSaqYf9bjj1UJ2eipZuNcI1nYousU=
go.sia.tech/jape v0.12.1/go.mod h1:wU+h6Wh5olDjkPXjF0tbZ1GDgoZ6VTi4naFw91yyWC4=
go.sia.tech/mux v1.3.0 h1:hgR34IEkqvfBKUJkAzGi31OADeW2y7D6Bmy/Jcbop9c=
Expand Down
10 changes: 5 additions & 5 deletions persist/sqlite/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func scanEvent(tx *txn, s scanner) (ev explorer.Event, eventID int64, err error)
FROM contract_payout_events ev
JOIN siacoin_elements sce ON ev.output_id = sce.id
JOIN file_contract_elements fce ON ev.contract_id = fce.id
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), &m.SiacoinOutput.MaturityHeight, decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value), decode(&m.FileContract.StateElement.ID), decode(&m.FileContract.StateElement.LeafIndex), decode(&m.FileContract.FileContract.Filesize), decode(&m.FileContract.FileContract.FileMerkleRoot), decode(&m.FileContract.FileContract.WindowStart), decode(&m.FileContract.FileContract.WindowEnd), decode(&m.FileContract.FileContract.Payout), decode(&m.FileContract.FileContract.UnlockHash), decode(&m.FileContract.FileContract.RevisionNumber), &m.Missed)
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), &m.SiacoinOutput.MaturityHeight, decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value), decode(&m.FileContract.ID), decode(&m.FileContract.StateElement.LeafIndex), decode(&m.FileContract.FileContract.Filesize), decode(&m.FileContract.FileContract.FileMerkleRoot), decode(&m.FileContract.FileContract.WindowStart), decode(&m.FileContract.FileContract.WindowEnd), decode(&m.FileContract.FileContract.Payout), decode(&m.FileContract.FileContract.UnlockHash), decode(&m.FileContract.FileContract.RevisionNumber), &m.Missed)
ev.Data = &m
case explorer.EventTypeMinerPayout:
var m explorer.EventMinerPayout
err = tx.QueryRow(`SELECT sc.output_id, sc.leaf_index, sc.maturity_height, sc.address, sc.value
FROM siacoin_elements sc
INNER JOIN miner_payout_events ev ON (ev.output_id = sc.id)
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value))
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value))
if err != nil {
return explorer.Event{}, 0, fmt.Errorf("failed to fetch miner payout event data: %w", err)
}
Expand All @@ -86,7 +86,7 @@ WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID),
err = tx.QueryRow(`SELECT sc.output_id, sc.leaf_index, sc.maturity_height, sc.address, sc.value
FROM siacoin_elements sc
INNER JOIN foundation_subsidy_events ev ON (ev.output_id = sc.id)
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.StateElement.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value))
WHERE ev.event_id = ?`, eventID).Scan(decode(&m.SiacoinOutput.ID), decode(&m.SiacoinOutput.StateElement.LeafIndex), decode(&m.SiacoinOutput.MaturityHeight), decode(&m.SiacoinOutput.SiacoinOutput.Address), decode(&m.SiacoinOutput.SiacoinOutput.Value))
ev.Data = &m
default:
return explorer.Event{}, 0, fmt.Errorf("unknown event type: %s", eventType)
Expand Down Expand Up @@ -180,7 +180,7 @@ func (s *Store) AddressEvents(address types.Address, offset, limit uint64) (even

func scanSiacoinOutput(s scanner) (sco explorer.SiacoinOutput, err error) {
var spentIndex types.ChainIndex
err = s.Scan(decode(&sco.StateElement.ID), decode(&sco.StateElement.LeafIndex), &sco.Source, decodeNull(&spentIndex), &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value))
err = s.Scan(decode(&sco.ID), decode(&sco.StateElement.LeafIndex), &sco.Source, decodeNull(&spentIndex), &sco.MaturityHeight, decode(&sco.SiacoinOutput.Address), decode(&sco.SiacoinOutput.Value))
if spentIndex != (types.ChainIndex{}) {
sco.SpentIndex = &spentIndex
}
Expand All @@ -189,7 +189,7 @@ func scanSiacoinOutput(s scanner) (sco explorer.SiacoinOutput, err error) {

func scanSiafundOutput(s scanner) (sfo explorer.SiafundOutput, err error) {
var spentIndex types.ChainIndex
err = s.Scan(decode(&sfo.StateElement.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value))
err = s.Scan(decode(&sfo.ID), decode(&sfo.StateElement.LeafIndex), decodeNull(&spentIndex), decode(&sfo.ClaimStart), decode(&sfo.SiafundOutput.Address), decode(&sfo.SiafundOutput.Value))
if spentIndex != (types.ChainIndex{}) {
sfo.SpentIndex = &spentIndex
}
Expand Down
20 changes: 10 additions & 10 deletions persist/sqlite/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme
defer stmt.Close()

for _, sce := range newElements {
result, err := stmt.Exec(encode(sce.StateElement.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(sce.StateElement.LeafIndex))
result, err := stmt.Exec(encode(sce.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(sce.StateElement.LeafIndex))
if err != nil {
return nil, fmt.Errorf("addSiacoinElements: failed to execute siacoin_elements statement: %w", err)
}
Expand All @@ -517,7 +517,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme
return nil, fmt.Errorf("addSiacoinElements: failed to get last insert ID: %w", err)
}

scDBIds[types.SiacoinOutputID(sce.StateElement.ID)] = dbID
scDBIds[types.SiacoinOutputID(sce.ID)] = dbID
}
}
if len(spentElements) > 0 {
Expand All @@ -531,7 +531,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme
defer stmt.Close()

for _, sce := range spentElements {
result, err := stmt.Exec(encode(sce.StateElement.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), encode(index), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(index), encode(sce.StateElement.LeafIndex))
result, err := stmt.Exec(encode(sce.ID), encode(index.ID), encode(sce.StateElement.LeafIndex), encode(index), int(sce.Source), sce.MaturityHeight, encode(sce.SiacoinOutput.Address), encode(sce.SiacoinOutput.Value), encode(index), encode(sce.StateElement.LeafIndex))
if err != nil {
return nil, fmt.Errorf("addSiacoinElements: failed to execute siacoin_elements statement: %w", err)
}
Expand All @@ -541,7 +541,7 @@ func addSiacoinElements(tx *txn, index types.ChainIndex, spentElements, newEleme
return nil, fmt.Errorf("addSiacoinElements: failed to get last insert ID: %w", err)
}

scDBIds[types.SiacoinOutputID(sce.StateElement.ID)] = dbID
scDBIds[types.SiacoinOutputID(sce.ID)] = dbID
}
}

Expand All @@ -561,7 +561,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme
defer stmt.Close()

for _, sfe := range newElements {
result, err := stmt.Exec(encode(sfe.StateElement.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex))
result, err := stmt.Exec(encode(sfe.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex))
if err != nil {
return nil, fmt.Errorf("addSiafundElements: failed to execute siafund_elements statement: %w", err)
}
Expand All @@ -571,7 +571,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme
return nil, fmt.Errorf("addSiafundElements: failed to get last insert ID: %w", err)
}

sfDBIds[types.SiafundOutputID(sfe.StateElement.ID)] = dbID
sfDBIds[types.SiafundOutputID(sfe.ID)] = dbID
}
}
if len(spentElements) > 0 {
Expand All @@ -585,7 +585,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme
defer stmt.Close()

for _, sfe := range spentElements {
result, err := stmt.Exec(encode(sfe.StateElement.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(index), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex), encode(index))
result, err := stmt.Exec(encode(sfe.ID), encode(index.ID), encode(sfe.StateElement.LeafIndex), encode(index), encode(sfe.ClaimStart), encode(sfe.SiafundOutput.Address), encode(sfe.SiafundOutput.Value), encode(sfe.StateElement.LeafIndex), encode(index))
if err != nil {
return nil, fmt.Errorf("addSiafundElements: failed to execute siafund_elements statement: %w", err)
}
Expand All @@ -595,7 +595,7 @@ func addSiafundElements(tx *txn, index types.ChainIndex, spentElements, newEleme
return nil, fmt.Errorf("addSiafundElements: failed to get last insert ID: %w", err)
}

sfDBIds[types.SiafundOutputID(sfe.StateElement.ID)] = dbID
sfDBIds[types.SiafundOutputID(sfe.ID)] = dbID
}
}
return sfDBIds, nil
Expand Down Expand Up @@ -732,7 +732,7 @@ func addEvents(tx *txn, scDBIds map[types.SiacoinOutputID]int64, fcDBIds map[exp
case *explorer.EventMinerPayout:
_, err = minerPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(event.ID)])
case *explorer.EventContractPayout:
_, err = contractPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(v.SiacoinOutput.StateElement.ID)], fcDBIds[explorer.DBFileContract{ID: types.FileContractID(v.FileContract.StateElement.ID), RevisionNumber: v.FileContract.FileContract.RevisionNumber}], v.Missed)
_, err = contractPayoutEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(v.SiacoinOutput.ID)], fcDBIds[explorer.DBFileContract{ID: types.FileContractID(v.FileContract.ID), RevisionNumber: v.FileContract.FileContract.RevisionNumber}], v.Missed)
case *explorer.EventFoundationSubsidy:
_, err = foundationSubsidyEventStmt.Exec(eventID, scDBIds[types.SiacoinOutputID(event.ID)])
default:
Expand Down Expand Up @@ -917,7 +917,7 @@ func updateFileContractElements(tx *txn, revert bool, b types.Block, fces []expl
}

if err := addFC(
types.FileContractID(fce.StateElement.ID),
types.FileContractID(fce.ID),
fce.StateElement.LeafIndex,
fce.FileContract,
update.Resolved,
Expand Down
4 changes: 2 additions & 2 deletions persist/sqlite/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func TestSendTransactions(t *testing.T) {
}

testutil.SignTransaction(cm.TipState(), pk1, &parentTxn)
scOutputID = types.Hash256(parentTxn.SiacoinOutputID(2))
scOutputID = types.SiacoinOutputID(parentTxn.SiacoinOutputID(2))
sfOutputID = parentTxn.SiafundOutputID(2)

// Mine a block with the above transaction
Expand Down Expand Up @@ -1438,7 +1438,7 @@ func TestRevertSendTransactions(t *testing.T) {
}

testutil.SignTransaction(cm.TipState(), pk1, &parentTxn)
scOutputID = types.Hash256(parentTxn.SiacoinOutputID(2))
scOutputID = types.SiacoinOutputID(parentTxn.SiacoinOutputID(2))
sfOutputID = parentTxn.SiafundOutputID(2)

// Mine a block with the above transaction
Expand Down
2 changes: 1 addition & 1 deletion persist/sqlite/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func encodedIDs(ids []types.FileContractID) []any {
func scanFileContract(s scanner) (contractID int64, fc explorer.FileContract, err error) {
var confirmationIndex, proofIndex types.ChainIndex
var confirmationTransactionID, proofTransactionID types.TransactionID
err = s.Scan(&contractID, decode(&fc.StateElement.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber))
err = s.Scan(&contractID, decode(&fc.ID), decode(&fc.StateElement.LeafIndex), &fc.Resolved, &fc.Valid, decode(&fc.TransactionID), decodeNull(&confirmationIndex), decodeNull(&confirmationTransactionID), decodeNull(&proofIndex), decodeNull(&proofTransactionID), decode(&fc.FileContract.Filesize), decode(&fc.FileContract.FileMerkleRoot), decode(&fc.FileContract.WindowStart), decode(&fc.FileContract.WindowEnd), decode(&fc.FileContract.Payout), decode(&fc.FileContract.UnlockHash), decode(&fc.FileContract.RevisionNumber))

if confirmationIndex != (types.ChainIndex{}) {
fc.ConfirmationIndex = &confirmationIndex
Expand Down
Loading
Loading