Activity

A feed of development activity from across Sia Foundation GitHub repositories.

May 16, 2024

This PR is a testing playground for a potential directories table. The goal is to find out whether a table like that can provide the index needed to significantly speed up fetching directory info on larger nodes with 500k+ objects.

  • Create dirs when objects are created
  • Delete empty dirs when objects are deleted
  • Create/Delete dirs when objects are renamed
  • SQLite migration code
  • MySQL migration code
  • Test performance before/after

UPDATE: I've experimented with multiple approaches so far. Directory table with full paths, with names only, recursive queries, non recursive ones, functional indices, generated columns with indices, partitioning, temporary tables and nested sets. The big problem seems to be our use-case of having 2 tables which don't just require a select but a group by on the sub-directories of the directory we want to query. According to some posts I have found about nested sets they were mostly used before MySQL supported recursive queries since recursive queries should perform the same for fetching immediate children and a lot faster for deep traversal. I confirmed that fetching the directories from the tree is quite fast at 10-20ms for a query that takes about 2 seconds in total using the recursive approach. However that part is fast for pretty much all approaches I have tested. The slow part is grouping the objects by parent dir which is pretty slow for every approach.

So I ended up choosing the fastest of all approaches I've tested which also happens to be the nicest query. A directory table that only contains the name of each directory instead of full path to avoid too much overhead. It takes about 800ms on my node with 500k objects and 150k directories in the higher level dirs compared to 2s for the fully recursive approach.

It is pretty straight forward and consists of 2 parts which are combined via UNION:

  1. We search for the directory that we want to query. Then we fetch all objects in that directory with a fast inner join.
  2. We search for all the child dirs with a quick inner join. Then we join all objects with these dirs using their paths before (and this is the slow part) grouping them by directory.
May 16, 2024
May 16, 2024

This PR adds errInvalidHandshake to the list of prune alert exception cases.

{
  "id": "h:010f0c2e5180fce43e054aab2d3479bcd860f5da960c1277ebfb97999e858ec5",
  "severity": "warning",
  "message": "Contract pruning failed",
  "data": {
    "contractID": "fcid:5f69293916b6a5ddecef0d60347b3ef198ca623d8453d14e949becb2b15f884d",
    "error": "failed to prune contract fcid:5f69293916b6a5ddecef0d60347b3ef198ca623d8453d14e949becb2b15f884d; NewRenterTransport: couldn't read host's handshake: EOF\n",
    "hostKey": "ed25519:0220dabd125931d000c48ada38fb39082e0c7e241a1a469f2527a0846f692d32",
    "hostVersion": "1.6.0",
    "origin": "autopilot.autopilot"
  },
  "timestamp": "2024-05-15T11:09:34.766139268Z"
}
May 16, 2024
May 15, 2024
May 15, 2024

This PR expands test coverage in merkle to 95.1% and overall consensus coverage to 76.2% Now that we have the coverage for DecodeFrom and EncodeTo I'm planning to add a roundtrip later, assuming you find such tests to be valuable.

May 15, 2024

Adds support for a yaml configuration file similar to hostd and renterd.

directory: /etc/walletd
autoOpenWebUI: true
http:
  address: :9980
  password: sia is cool
consensus:
  network: mainnet
  gatewayAddress: :9981
  bootstrap: false
  enableUPnP: false
index:
  mode: partial # full, partial, none (full index will index the entire blockchain, partial will only index addresses that are registered in the wallet, none will treat the database as read-only and not index any new data)
  batchSize: 64 # max number of blocks to index at a time (increasing this will increase scan speed, but also increase memory and cpu usage)
log:
  level: info # global log level
  stdout:
    enabled: true # enable logging to stdout
    level: debug # override the global log level for stdout
    enableANSI: false
    format: human # human or JSON
  file:
    enabled: true # enable logging to a file
    level: debug # override the global log level for the file
    path: /var/log/walletd.log
    format: json # human or JSON
May 15, 2024

Testing the migration on my node I found that we have to tweak the upload penalty in some cases.

May 15, 2024

This PR expands test coverage in policy.go to 86.5% and overall types coverage to 59.7%

May 14, 2024

Changes the read and write RPC to send internal errors and alert+log the actual error.

May 14, 2024
May 14, 2024

This PR adds a SQL database wrapper similar to the one in hostd which will eventually allow us to get rid of gorm.

The Backend and BackendMetrics interfaces are the interfaces that we will extend over time until we don't use gorm anymore. For the start the interfaces are only used to close the databases as well as get the version for printing.

One noteworthy change in functionality is that we now also use an inverted approach to retrying transactions. We no longer have a whitelist of errors for which we skip the retry but we always skip the retry unless a db specific error is encountered indicating the database is locked.

May 14, 2024

Fixes a small race introduced when the handling of tpool utxos changed

May 14, 2024

Bumps go.sia.tech/web/renterd from 0.52.0 to 0.52.1.

Release notes

Sourced from go.sia.tech/web/renterd's releases.

renterd@0.52.1

Patch Changes

  • c89d2e55: Fixed an issue where the recommendations bar was overlapping notifications.
  • c89d2e55: Fixed an issue where clearing some configuration fields would crash the app due to how recommendations were being calculated.
  • c89d2e55: The configuration recommendations now instruct the user to first fill all fields. Closes SiaFoundation/renterd#1214
Commits
  • a70394c chore: release packages
  • c89d2e5 fix: renterd recommendations states and crashing
  • e989296 chore: export hostd/v0.42.0
  • 8f37216 chore: release packages
  • 5760861 fix: hostd pinned threshold advanced
  • 137b003 chore: export renterd/v0.52.0 hostd/v0.41.0
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 14, 2024

Bumps github.com/cloudflare/cloudflare-go from 0.94.0 to 0.95.0.

Release notes

Sourced from github.com/cloudflare/cloudflare-go's releases.

v0.95.0

ENHANCEMENTS:

  • access_application: add support for policies array (#1956)
  • access_application: add support for scim_config (#1921)
  • access_policy: add support for reusable policies (#1956)
  • dlp: add support for zt risk behavior configuration (#1887)

BUG FIXES:

  • access_application: fix scim configuration authentication json marshalling (#1959)

DEPENDENCIES:

  • deps: bumps dependabot/fetch-metadata from 2.0.0 to 2.1.0 (#1839)
  • deps: bumps github.com/urfave/cli/v2 from 2.27.1 to 2.27.2 (#1861)
  • deps: bumps golang.org/x/net from 0.24.0 to 0.25.0 (#1974)
  • deps: bumps golangci/golangci-lint-action from 4 to 5 (#1845)
  • deps: bumps golangci/golangci-lint-action from 5 to 6 (#1975)
Changelog

Sourced from github.com/cloudflare/cloudflare-go's changelog.

0.95.0 (May 8th, 2024)

ENHANCEMENTS:

  • access_application: add support for policies array (#1956)
  • access_application: add support for scim_config (#1921)
  • access_policy: add support for reusable policies (#1956)
  • dlp: add support for zt risk behavior configuration (#1887)

BUG FIXES:

  • access_application: fix scim configuration authentication json marshalling (#1959)

DEPENDENCIES:

  • deps: bumps dependabot/fetch-metadata from 2.0.0 to 2.1.0 (#1839)
  • deps: bumps github.com/urfave/cli/v2 from 2.27.1 to 2.27.2 (#1861)
  • deps: bumps golang.org/x/net from 0.24.0 to 0.25.0 (#1974)
  • deps: bumps golangci/golangci-lint-action from 4 to 5 (#1845)
  • deps: bumps golangci/golangci-lint-action from 5 to 6 (#1975)
Commits
  • 4788db7 Update CHANGELOG.md
  • 3f615f5 update CHANGELOG
  • d4a7f8d Merge pull request #1975 from cloudflare/dependabot/github_actions/golangci/g...
  • a1fda3a Merge branch 'master' into dependabot/github_actions/golangci/golangci-lint-a...
  • 0026065 Merge pull request #1974 from cloudflare/dependabot/go_modules/golang.org/x/n...
  • 04c2ceb add CHANGELOG for #1975
  • e3ab1b2 build(deps): bump golangci/golangci-lint-action from 5 to 6
  • be510c4 add CHANGELOG for #1974
  • e35c25d build(deps): bump golang.org/x/net from 0.24.0 to 0.25.0
  • a8e30d4 Merge pull request #1959 from khiller-cf/master
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 8, 2024

Accidentally left the default as full index mode

May 8, 2024

This PR updates the root cache in the ContractManager when a contract gets renewed, essentially copying over the roots from existing to renewal. I'm keeping this as a DRAFT @n8maninger because it's merely to illustrate the problem, the real fix is (likely) something else entirely and this will also need a thorough regression test. I don't mind taking a stab at it but I felt this is probably something that you will want to write the fix for yourself.

Context: In renterd we have a test called TestUploadDownloadSpending that fails locally with AppendSector: proof verification failed on the branch pj/subscription-api. The reason it fails is because hostd builds the proof of a recently renewed contract without sector roots. I sprinkled some logging in the host's contract manager and also the proof code in core and found that we seem to update the database just fine on renewal but the next time the contract updater fetches the roots from the store it returns 0 roots. Causing the host to try and build a proof where secRoots is empty causing it to fail when verifying. I considered the possibility that something was removing those roots but I added panics in all delete and trim methods and those aren't hit during the test.

DEBUG PJ: host: contract manager: store renew contract fcid:d0ddaa094b8082ec760af191a241403846b89136ee1b6343f42bda1044a4e434 -> fcid:9fe0027ea0f4e28861fffcc86a06a93969e49acf98fa18d60de7919f89293c7e
DEBUG PJ: store: renew fcid:d0ddaa094b8082ec760af191a241403846b89136ee1b6343f42bda1044a4e434 -> fcid:9fe0027ea0f4e28861fffcc86a06a93969e49acf98fa18d60de7919f89293c7e updated 3 roots
DEBUG PJ: host: contract updater:  fcid:9fe0027ea0f4e28861fffcc86a06a93969e49acf98fa18d60de7919f89293c7e append sector, new sector roots cnt 1
DEBUG PJ: host: contract updater: fcid:9fe0027ea0f4e28861fffcc86a06a93969e49acf98fa18d60de7919f89293c7e current sector roots cnt 1
DEBUG PJ: core0.2.3: BuildDiffProof
actions: [{Type:Append A:0 B:0 Data:[]}]
secRoots: []
treeHas: []
leafHas: []
DEBUG PJ: core0.2.3: VerifyDiffProof
actions: [{Type:Append A:0 B:0 Data:[]}]
numleav: 3
treeHas: []
leafHas: []
oldRoot: h:5927721564a242691a0ca9d58f810087ca838fe5205989417296cc6181939067
newRoot: h:c076a802cc2791cb30a710a1977e88e540abff86d091014117ed8e0321c43a66
appRoot: [h:c076a802cc2791cb30a710a1977e88e540abff86d091014117ed8e0321c43a66]
OK: false

Couple of things I find especially odd/interesting is that it passes on CI, so somehow this is a race condition, and also if we really consider the contract to be empty after renewal, even for a short period of time, this would wreak some serious havoc on production so it's probably somehow not that big of an issue or a really small window or something.

May 8, 2024

This PR updates hostd, core and coreutils.

May 8, 2024

Adds "Full" and "None" indexing modes. The indexing mode can only be set once and cannot be changed since it changes how the state tree is stored.

"Partial" is the default. It only stores the state and events for addresses that are connected to a wallet.

"Full" will store the entire state of the blockchain regardless of addresses loaded into the wallet. It will also throw an error if the user attempts to trigger a scan with /wallet/scan

"None" will not process chain updates and treat the chain state as read-only. This isn't particularly useful now, but it will be nice when networked databases are supported.

May 8, 2024
  • Fixed an issue where clearing some configuration fields would crash the app due to how recommendations were being calculated.
  • The configuration recommendations now instruct the user to first fill all fields.
  • Fixed an issue where the recommendations bar was overlapping notifications.
May 7, 2024
May 7, 2024

@peterjan, is this enough to fix the race condition, or do I need to change the deferred release to only be called when the transaction should be dropped?

May 7, 2024
May 7, 2024

fix a typo cient -> client

May 7, 2024

Bumps go.sia.tech/core from 0.2.2 to 0.2.3.

Commits
  • f9d44a4 Merge pull request #148 from new0nebit/flourish
  • fdfc700 Merge pull request #150 from SiaFoundation/surpass
  • 54775af Merge pull request #152 from SiaFoundation/dependabot/go_modules/golang.org/x...
  • 71ccc09 build(deps): bump golang.org/x/crypto from 0.21.0 to 0.22.0
  • c5cb20b Improve SpendPolicy and SatisfiedPolicy tests based on feedback
  • 3b09dcb consensus: Add (State).SufficientlyHeavierThan
  • b038144 Add Test Coverage for SatisfiedPolicy and enhance SpendPolicy tests
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 7, 2024

Bumps golang.org/x/term from 0.19.0 to 0.20.0.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 7, 2024

Bumps golang.org/x/term from 0.19.0 to 0.20.0.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 7, 2024

Bumps golang.org/x/sys from 0.19.0 to 0.20.0.

Commits
  • 7d69d98 unix: extend support for z/OS
  • 7758090 cpu: add support for sve2 detection
  • 9a28524 windows: drop go version tags for unsupported versions
  • 27dc90b unix: update to Linux kernel 6.4
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 6, 2024

I'm assuming this snuck in at one point or something. Or maybe this pre-dates us moving ExplicitCoveredFields to coreutils but in any case we should get rid of it because it's not worth having renterd as a dependency (which soon will no longer have a wallet package).

May 6, 2024

Bumps go.sia.tech/core from 0.2.2 to 0.2.3.

Commits
  • f9d44a4 Merge pull request #148 from new0nebit/flourish
  • fdfc700 Merge pull request #150 from SiaFoundation/surpass
  • 54775af Merge pull request #152 from SiaFoundation/dependabot/go_modules/golang.org/x...
  • 71ccc09 build(deps): bump golang.org/x/crypto from 0.21.0 to 0.22.0
  • c5cb20b Improve SpendPolicy and SatisfiedPolicy tests based on feedback
  • 3b09dcb consensus: Add (State).SufficientlyHeavierThan
  • b038144 Add Test Coverage for SatisfiedPolicy and enhance SpendPolicy tests
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 6, 2024

Bumps golang.org/x/sys from 0.19.0 to 0.20.0.

Commits
  • 7d69d98 unix: extend support for z/OS
  • 7758090 cpu: add support for sve2 detection
  • 9a28524 windows: drop go version tags for unsupported versions
  • 27dc90b unix: update to Linux kernel 6.4
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 6, 2024

Bumps golang.org/x/crypto from 0.22.0 to 0.23.0.

Commits
  • 905d78a go.mod: update golang.org/x dependencies
  • ebb717d ssh: validate key type in SSH_MSG_USERAUTH_PK_OK response
  • 0da2a6a openpgp: fix function name in comment
  • 5defcc1 sha3: fix Sum results for SHAKE functions on s390x
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 6, 2024

Bumps golang.org/x/term from 0.19.0 to 0.20.0.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 6, 2024

Bumps golang.org/x/sys from 0.19.0 to 0.20.0.

Commits
  • 7d69d98 unix: extend support for z/OS
  • 7758090 cpu: add support for sve2 detection
  • 9a28524 windows: drop go version tags for unsupported versions
  • 27dc90b unix: update to Linux kernel 6.4
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
May 3, 2024
  • 5760861a: Moved the pinned currency change threshold to advanced mode settings.
May 3, 2024

This changes the wallet.Event JSON serialization to match the Go struct. Unfortunately, this will break the UI again @alexfreska.

  • Adds the maturityHeight field. The UI should use this to distinguish between received-but-not-spendable payouts (maybe lower the opacity or add a "lock" icon).
  • Changes the val field to data to match the rest of walletd.
{
  "id": "h:13271ead1070290c9cbe39ed7a15aa1107a27029479858ee9ab2fcc237ed4aa0",
  "timestamp": "2024-05-01T11:35:03Z",
  "index": {
    "height": 68278,
    "id": "bid:000000009db92b8834aed7809ebe3ff0184e632e8333bba3802de8cd10d2fc86"
  },
  "maturityHeight": 68423,
  "relevant": [
    "addr:11d68c52e67a800d0ca99867e410cfa9c0c3f5bc1726aa90e88f40b7ad0825c91841904dae10"
  ],
  "type": "contract payout",
  "data": {...}
}
May 3, 2024
  • Moved the pinned currency change threshold to advanced mode settings.
May 3, 2024
May 3, 2024
  • Adds a walletd-js library.
import { Walletd } from '@siafoundation/walletd-js'

const walletd = Walletd({
  api: 'http://localhost:9980/api',
  password: 'password1337',
})

const events = await walletd.walletEvents({
  params: {
    id: 'wallet-1',
    limit: 10,
    offset: 0,
  },
})
const peers = await walletd.syncerPeers()
console.log(events.data, peers.data)
May 3, 2024
  • Adds a hostd-js library.
import { Hostd } from '@siafoundation/hostd-js'

export async function example() {
  const hostd = Hostd({
    api: 'http://localhost:9980/api',
    password: 'password1337',
  })
  const state = await hostd.stateHost()
  const volumes = await hostd.volumes()
  console.log(state.data, volumes.data)
}
May 3, 2024

It turns out that Chris 's hunch was right and that we are not tracking sector upload estimates at times we should be, even worse we currently don't track anything at times we should be penalising the host for being slow. I added explicit logging for when we penalise a host for being (super) slow, so going to follow this up on my node to be sure.

Overall I thought it was a little tricky to come up with a good way to fix it and to write a solid unit and/or integration test for it. If we really want to check the exact errors we would need an integration test but that would involve a level of orchestration we are currently not capable of doing from an integration test. The unit test I came up with is not exactly what I was hoping for but it does cover all branches.

Closes https://github.com/SiaFoundation/renterd/issues/1167

May 2, 2024

This implements soft delete for spent elements, sidestepping the issue of reverts clobbering the chain index. Spent elements will be pruned 144 blocks after their spend height. This also reverts the removal of the chain_indices table to use the foreign key as a bug sanity check.

May 2, 2024

This PR passes an appliedIndex to revertChainUpdate which is used whenever we re-add elements. Before, we were re-adding those elements using the revertIndex which is definitely incorrect because we go and delete those in revertIndex. I renamed revertIndex to removeEvents and changed it to only remove events because if a revert is processed correctly the elements should already have been removed.

The idea of an appliedIndex as the counterpart for every revertIndex feels a bit naive maybe but I decided to propose it nonetheless because I don't see what's wrong with it either. If we can't do that I feel the only thing we're left with is soft deletion but that comes with its own issues, mostly complexity trade-off.

May 2, 2024

Fixes #85

May 1, 2024
  • Fixes a panic when calling [GET|PUT] /settings/pinned with explorer data disabled
  • Adds explorer info to the [GET] /state/host endpoint
May 1, 2024

2 line change to close statements that were not closed

Apr 30, 2024

This PR makes sure that when you run renterd config and select sqlite there's no mysql section in the renterd.yml file (and vice versa of course). I figured this was a good opportunity to make the sqlite database names configurable and refactor the bus config in a way that creating the database connections (and logger) are better placed I think, it was a bit scattered before. There's actually a bunch of small changes that overall clean things up.

Fixes https://github.com/SiaFoundation/renterd/issues/1201

Apr 30, 2024

Bumps go.sia.tech/gofakes3 from 0.0.2 to 0.0.3.

Commits
  • d7c039f Merge pull request #6 from SiaFoundation/chris/return-access-key
  • d01e417 move routing into routeBase
  • 1f29cb8 signature: return access key when V4SignVerify is successful
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 30, 2024
Apr 30, 2024

Bumps github.com/cloudflare/cloudflare-go from 0.93.0 to 0.94.0.

Release notes

Sourced from github.com/cloudflare/cloudflare-go's releases.

v0.94.0

ENHANCEMENTS:

  • access_application: support options_preflight_bypass for access_application (#1790)
  • gateway: added ecs_support field to teams_location resource (#1826)
  • teams_account: adds custom certificate setting to teams account configuration (#1811)
  • workers: support deleting namespaced Workers (#1737)

DEPENDENCIES:

  • deps: bumps golang.org/x/net from 0.19.0 to 0.23.0 (#1825)
Changelog

Sourced from github.com/cloudflare/cloudflare-go's changelog.

0.94.0 (April 24th, 2024)

ENHANCEMENTS:

  • access_application: support options_preflight_bypass for access_application (#1790)
  • gateway: added ecs_support field to teams_location resource (#1826)
  • teams_account: adds custom certificate setting to teams account configuration (#1811)
  • workers: support deleting namespaced Workers (#1737)

DEPENDENCIES:

  • deps: bumps golang.org/x/net from 0.19.0 to 0.23.0 (#1825)
Commits
  • 4cfc90f Update CHANGELOG.md
  • e225010 update CHANGELOG
  • bdbee54 Merge pull request #1826 from alyssamw/master
  • ac539ee Merge branch 'master' into master
  • 6f6d756 GFI-151: add ecs_support to teams_location
  • 5ea2d0a Merge pull request #1825 from cloudflare/dependabot/go_modules/internal/tools...
  • 38f5378 add CHANGELOG for #1825
  • e96653c build(deps): bump golang.org/x/net in /internal/tools
  • 04b36cd Merge pull request #1790 from russellkerns/rkerns/AUTH-6000
  • 7b0666a Merge branch 'master' into rkerns/AUTH-6000
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 29, 2024
Apr 29, 2024

Bumps github.com/minio/minio-go/v7 from 7.0.69 to 7.0.70.

Release notes

Sourced from github.com/minio/minio-go/v7's releases.

Bugfix Release

What's Changed

New Contributors

Full Changelog: https://github.com/minio/minio-go/compare/v7.0.68...v7.0.70

Commits
  • c2fe179 remove sha256-simd support we do not need it anymore (#1958)
  • 0e5a768 avoid trailing checksums for zero byte objects
  • afa8d59 Bump golang.org/x/net from 0.21.0 to 0.23.0 in /examples/minio (#1955)
  • 0558c7e Bump golang.org/x/net from 0.21.0 to 0.23.0 (#1954)
  • bfc8151 remove broken codeql integration from GitHub
  • e44abd3 fix: non md5 etags (#1952)
  • 18e8073 Update vulncheck Go version to 1.22.x (#1953)
  • e8ddcf0 Update version to next release
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 29, 2024

Bumps gorm.io/gorm from 1.25.9 to 1.25.10.

Commits
  • 9d370bc Fix handling of unknown column types (#6540)
  • 7892019 Fix panic bug in migrator due to lack of nil check for stmt.Schema (#6932)
  • ac59252 Add new error for "Violation Check Constraint" (#6992)
  • 207f1ac fix: not clause with or condition (#6984)
  • 85299bf perf: merge nested preload query when using join (#6990)
  • 5553ff3 downgrade mssql driver
  • bc49365 Faster utils.FileWithLineNum (#6981)
  • d0b4ceb Added comment describing Unscoped() method (#6969)
  • 9a61ef2 fix: duplicated preload (#6948)
  • 1e13fd7 Fix duplicated columns in INSERT SQL for some fields with default value
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 24, 2024

This PR removes the chain_indices table. I'm not entirely sure that's what we want but since we were discussing getting rid of the CASCADE deletes I don't see a good reason to keep the table. Creating it and linking it is more of a nuisance than anything else imo, if you don't get the upside of the cascaded deletes.

I hit an interesting test failure in the process, an underflow is triggered in TestEphemeralBalance which is interesting because on master there are no orphaned indices, but now there are orphaned siacoin_elements... so I'm a little bit puzzled still on why that is.

I think there might also be a bug in RevertOrphans because we loop over the orphaned indices and it seems we only deal with the balances of the last orphan. (consensus.go:751) Since I'm not sure whether we want to get rid of the chain_indices entirely I'm going to keep it in DRAFT until tomorrow when Nate is back from being OOO.

Apr 24, 2024
  • Fixed an issue where volume resize and delete dialogs were not loading the volumes data.
  • Updated volume resize dialog to used shared helpers for consistency.

Explanation

  • Recently fixed an issue where dialogs were not triggering onOpenChange(true) when initially opening, this combined with an incorrect handler that previously never was called caused the id passed to volume dialogs to get wiped out.
Apr 24, 2024
  • 8 min - Moves JS linting, testing, e2e testing out to a parallel job
  • 3 min - Moves docker container build and publish out to a parallel job
Apr 24, 2024

Our jobs are kind of slow so I was looking at ways to speed them up. I couldn't really find any low hanging fruit but ended up extracting two steps (lint & analyze) I think should be run separately because they do not depend on the os or go-version. It saves us roughly a minute so nothing ground breaking.

I ended up removing the dev trigger for the CodeQL job. I'm fine reverting that change but I feel we run that a lot without any real upside (so far). I can't remember the time it failed and made me change my PR for the better, since it takes more than two minutes on every single run maybe it's fine to only run it when we merge dev.

Apr 24, 2024

Caught these errors on renterd shutdown, fixed by adding a context.DeadlineExceeded case in abortRetry.

2024-04-23T10:49:08Z INFO  bus  successfully saved 392 accounts
2024-04-23T10:49:42Z ERROR SQL  trace {"error": "context deadline exceeded", "elapsed": "34.701151966s", "rows": 0, "sql": "\nDELETE\nFROM slabs\nWHERE NOT EXISTS (SELECT 1 FROM slices WHERE slices.db_slab_id = slabs.id)\nAND slabs.db_buffered_slab_id IS NULL\n"}
2024-04-23T10:49:42Z WARN  sql  transaction attempt 1/7 failed, retry in 200ms,  err: context deadline exceeded
2024-04-23T10:49:42Z WARN  sql  transaction attempt 2/7 failed, retry in 500ms,  err: context deadline exceeded
2024-04-23T10:49:43Z WARN  sql  transaction attempt 3/7 failed, retry in 1s,  err: context deadline exceeded
2024-04-23T10:49:44Z WARN  sql  transaction attempt 4/7 failed, retry in 3s,  err: context deadline exceeded
2024-04-23T10:49:47Z WARN  sql  transaction attempt 5/7 failed, retry in 10s,  err: context deadline exceeded
2024-04-23T10:49:57Z WARN  sql  transaction attempt 6/7 failed, retry in 10s,  err: context deadline exceeded
Apr 24, 2024
Apr 24, 2024
Apr 24, 2024

Not doing so caused slight differences in the returned value. e.g. it seemed like the number of usable hosts can improve by manually tweaking settings but no recommendation was returned.

Deployed this to Arequipa for testing @alexfreska If you set the target to 300 it should give you a recommendation now.

--- Current contracts ---
Contracts: 266
--- Target contracts ---
Contracts.Amount: 300
--- Before ---
MaxDownloadPrice: 1 KS
{
  "hosts": 722,
  "usable": 273,
  "unusable": {
    "blocked": 0,
    "gouging": {
      "contract": 12,
      "download": 109,
      "gouging": 131,
      "pruning": 7,
      "upload": 24
    },
    "notAcceptingContracts": 83,
    "notScanned": 86
  },
  "recommendation": {
    "gougingSettings": {
      "maxRPCPrice": "10000000000000000000",
      "maxContractPrice": "5000000000000000000000000",
      "maxDownloadPrice": "1155000000000000000000000000",
      "maxUploadPrice": "333333333000000000000000000",
      "maxStoragePrice": "154166666667",
      "hostBlockHeightLeeway": 12,
      "minPriceTableValidity": 600000000000,
      "minAccountExpiry": 86400000000000,
      "minMaxEphemeralAccountBalance": "1000000000000000000000000",
      "migrationSurchargeMultiplier": 10
    }
  }
}
--- After ---
MaxDownloadPrice: 1.03 KS
{
  "hosts": 722,
  "usable": 274,
  "unusable": {
    "blocked": 0,
    "gouging": {
      "contract": 12,
      "download": 107,
      "gouging": 131,
      "pruning": 7,
      "upload": 24
    },
    "notAcceptingContracts": 83,
    "notScanned": 86
  },
  "recommendation": {
    "gougingSettings": {
      "maxRPCPrice": "10000000000000000000",
      "maxContractPrice": "5000000000000000000000000",
      "maxDownloadPrice": "1135575000000000000000000000",
      "maxUploadPrice": "333333333000000000000000000",
      "maxStoragePrice": "154166666667",
      "hostBlockHeightLeeway": 12,
      "minPriceTableValidity": 600000000000,
      "minAccountExpiry": 86400000000000,
      "minMaxEphemeralAccountBalance": "1000000000000000000000000",
      "migrationSurchargeMultiplier": 10
    }
  }
}
Apr 23, 2024
  • Fixed an issue where file health slab keys were showing up as repeated and incorrect.
Apr 23, 2024
Apr 23, 2024

This removes the random data fill of volumes, enabling Linux and macOS to use sparse files again. However, this does have the side effect of "breaking" size detection when initializing and growing volumes, with no easy solution.I think that's acceptable to reduce hardware wear and tear and increase volume initialization performance.

Another option is to throw this behind an opt-in config flag for advanced users. That would prevent beginners from over-initializing their volumes while allowing advanced users to take advantage of filesystem optimizations.

Apr 23, 2024
Apr 22, 2024
  • Lint passed on windows with both:
    • git config --global core.autocrlf false
    • .gitattributes: *.go text eol=lf
Apr 22, 2024

Switches the nextjs Go router to use path instead of filepath to prevent issues on Windows. Also adds a few sanity tests to make sure the routers initialize correctly.

Apr 22, 2024
  • File is only supported in browsers, widening these upload types to accept other data.
Apr 19, 2024
  • Added support for autopilot config evaluation API to renterd-js and renterd-react.
  • Added a method for each known bus setting (eg: bus.settingGouging), in addition to the generic bus.setting method.
    • The hook variants already existed in renterd and were moved to renterd-react.
Apr 18, 2024
  • Adds proper content type and encoding to file upload and download methods
  • Cleans up redundant content type handling code
Apr 18, 2024

When a scan is interrupted, orphaned blocks will never be reverted from the wallet store. This adds a check for orphans when scanning and reverts their state from the store.

Apr 18, 2024
Apr 17, 2024
Apr 17, 2024
  • Sia Central SDK updated to use @siafoundation/request.
  • @siafoundation/renterd-js examples updated to new API.
Apr 16, 2024

I started writing this code during the last hackathon for fun, practicing writing test cases. But I didn't finish it because I had to switch to the main task regarding consensus coverage. I felt bad for wipe out a work that had been done, so I ended up finishing the code and also making some changes to it. Initially, I was only aiming to cover the SatisfiedPolicy but got carried away and started covering the PolicyTypeAbove and PolicyTypePublicKey, completely overlooking the fact that you had already done this 😅 Anyway, here it is. I hope that this alternative approach and the additional scenarios will prove valuable to you 🙏

Apr 16, 2024
Apr 16, 2024

Bumps github.com/cloudflare/cloudflare-go from 0.92.0 to 0.93.0.

Release notes

Sourced from github.com/cloudflare/cloudflare-go's releases.

v0.93.0

BREAKING CHANGES:

  • dns: Remove "locked" flag which is always false (#1618)

ENHANCEMENTS:

  • magic_transit_ipsec_tunnel: Adds support for replay_protection boolean flag (#1710)

DEPENDENCIES:

  • deps: bumps golang.org/x/net from 0.22.0 to 0.24.0 (#1688)
Changelog

Sourced from github.com/cloudflare/cloudflare-go's changelog.

0.93.0 (April 10th, 2024)

BREAKING CHANGES:

  • dns: Remove "locked" flag which is always false (#1618)

ENHANCEMENTS:

  • magic_transit_ipsec_tunnel: Adds support for replay_protection boolean flag (#1710)

DEPENDENCIES:

  • deps: bumps golang.org/x/net from 0.22.0 to 0.24.0 (#1688)
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 16, 2024

Bumps github.com/shopspring/decimal from 1.3.1 to 1.4.0.

Release notes

Sourced from github.com/shopspring/decimal's releases.

v1.4.0

Full Changelog can be found in CHANGELOG.md

New Contributors

Changelog

Sourced from github.com/shopspring/decimal's changelog.

Decimal v1.4.0

BREAKING

  • Drop support for Go version older than 1.10 #361

FEATURES

  • Add implementation of natural logarithm #339 #357
  • Add improved implementation of power operation #358
  • Add Compare method which forwards calls to Cmp #346
  • Add NewFromBigRat constructor #288
  • Add NewFromUint64 constructor #352

ENHANCEMENTS

  • Migrate to Github Actions #245 #340
  • Fix examples for RoundDown, RoundFloor, RoundUp, and RoundCeil #285 #328 #341
  • Use Godoc standard to mark deprecated Equals and StringScaled methods #342
  • Removed unnecessary min function for RescalePair method #265
  • Avoid reallocation of initial slice in MarshalBinary (GobEncode) #355
  • Optimize NumDigits method #301 #356
  • Optimize BigInt method #359
  • Support scanning uint64 #131 #364
  • Add docs section with alternative libraries #363

BUGFIXES

  • Fix incorrect calculation of decimal modulo #258 #317
  • Allocate new(big.Int) in Copy method to deeply clone it #278
  • Fix overflow edge case in QuoRem method #322
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 15, 2024

Bumps go.sia.tech/core from 0.2.1 to 0.2.2.

Commits
  • f424825 Merge pull request #151 from SiaFoundation/nate/vzeroupper
  • 69d6da0 blake2b: clear upper registers for 2x gain
  • 1ae0547 Merge pull request #149 from SiaFoundation/ifelse
  • 097e517 lint: Use whitelist for gocritic
  • 90599f1 lint: Satisfy unslice
  • 88ba8c8 lint: Disable 'ifElseChain' gocritic check
  • e781eaa Update project-add.yml
  • 89e9456 Merge pull request #147 from SiaFoundation/nate/rhp2-release
  • 008e275 add release to rhp2 settings
  • c9bd79d Merge pull request #146 from SiaFoundation/currency-string
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 15, 2024

Bumps golang.org/x/sys from 0.18.0 to 0.19.0.

Commits
  • cabba82 windows: use uint32 for serial comm flags for consistency
  • 1a50d97 windows: add serial comm functions
  • 95f07ec x/sys/windows: add func windows.DisconnectNamedPipe(handle Handle) (err error)
  • 4be02d3 unix: expose mmap calls on z/OS
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 15, 2024

Bumps golang.org/x/crypto from 0.21.0 to 0.22.0.

Commits
  • d042a39 go.mod: update golang.org/x dependencies
  • b92bf94 ssh: respect MaxAuthTries also for "none" auth attempts
  • 6f79b5a ssh: add server side multi-step authentication
  • 8d0d405 x/crypto/chacha20: cleanup chacha_ppc64le.s
  • b91329d all: remove redundant words in comments and fix some typos
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 10, 2024

Bumps golang.org/x/term from 0.18.0 to 0.19.0.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 10, 2024

Bumps golang.org/x/sys from 0.18.0 to 0.19.0.

Commits
  • cabba82 windows: use uint32 for serial comm flags for consistency
  • 1a50d97 windows: add serial comm functions
  • 95f07ec x/sys/windows: add func windows.DisconnectNamedPipe(handle Handle) (err error)
  • 4be02d3 unix: expose mmap calls on z/OS
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Apr 5, 2024

Closes #98

Apr 4, 2024

Before

goos: linux
goarch: amd64
pkg: go.sia.tech/core/internal/blake2b
cpu: AMD EPYC 7B13 64-Core Processor                
BenchmarkBLAKE2b/SumLeaves-128           4167430               290.8 ns/op       880.38 MB/s           0 B/op          0 allocs/op
BenchmarkBLAKE2b/SumNodes-128            3793945               285.3 ns/op       897.44 MB/s           0 B/op          0 allocs/op
PASS
ok      go.sia.tech/core/internal/blake2b       4.610s

After

goos: linux
goarch: amd64
pkg: go.sia.tech/core/internal/blake2b
cpu: AMD EPYC 7B13 64-Core Processor                
BenchmarkBLAKE2b/SumLeaves-128           6697410               176.7 ns/op      1448.80 MB/s           0 B/op          0 allocs/op
BenchmarkBLAKE2b/SumNodes-128            5853004               181.6 ns/op      1409.40 MB/s           0 B/op          0 allocs/op
PASS
ok      go.sia.tech/core/internal/blake2b       4.376s
Apr 3, 2024
Apr 3, 2024
  • Adds an endpoint for build info to match hostd and renterd
  • Renames POST /resubscribe to POST /rescan. This endpoint will now return immediately.
  • Adds GET /rescan to track rescan progress
  • Moves some of the the peer store fields into memory. I noticed that the peer store was causing a lot of write lock contention when syncing. We could solve this by syncing the data less frequently, but the fields didn't seem overly important to keep after the session ends.
Apr 2, 2024
Apr 2, 2024

Fixes an underflow panic when calling resubscribe

Mar 30, 2024
Mar 28, 2024
Mar 26, 2024
Mar 25, 2024

This is mostly in a good place, but there is one major sticking point: wallet.NewManager.

With the old API, when a call to cm.AddBlocks returns, all of the subscribers will have finished processing the new update(s). With the new API, this is not true; the processing happens asynchronously. This broke some tests which expected that, after calling AddBlocks, they could immediately observe the effects of those blocks in wallet state. Now, they can't, so we need a way for the test to wait until processing has finished. In most of the tests, I worked around this; see the syncDB helper I added. But that approach doesn't work when you have a real wallet manager running. For now, I faked the waiting with time.Sleep, just to see if that makes the tests pass (it does), but clearly we need a better solution.

The whole asynchronous processing thing really bugs me, so much so that I tweaked the new API to release the chain manager's lock before calling the onReorg listener functions. This means it's now legal for your listener function to call chain manager methods -- meaning, you can implement subscription "the old fashioned way" and have your onReorg function directly call UpdatesSince in a loop until it's caught up. Effectively this brings us back to the same situation as before, except that the manager is no longer locked, so you have a bit more freedom. (And of course, you can still do async processing if you want.)

But the other big wrinkle here is the wallet manager's Subscribe method. Previously, it unsubscribed from the chain manager, then resubscribed at a lower height. Firstly, it's not clear to me why this would work; won't you end up with duplicate state? But more importantly, we need to nail down how this action ought to interact with the wallet manager's ongoing subscription in the new API. In my PR code, we hold the wallet manager's lock while syncing, so Subscribe effectively pauses the background subscription until it's finished. Not exactly pretty, but it gets the job done. Is there a better way? That's what I'm not sure about.

Mar 25, 2024
Mar 19, 2024

Cherry-picked from #142

Mar 18, 2024
Mar 15, 2024
Old: "~2.529 mS"
New: "2.529378333356156158367 mS"

We discussed removing the SI units as well, and using SC exclusively (i.e. the example above would be 2.529378333356156158367 mS), but there was less consensus on that.

Since String is now exact, ExactString has been removed; if you want raw Hastings values, you can use Big or fmt.Sprintf("%d", c). If you want a rounded value, you can use standard approaches to round the float64 returned by Siacoins.

Mar 11, 2024
Mar 7, 2024

Bumps golang.org/x/sys from 0.5.0 to 0.18.0.

Commits
  • 360f961 unix: add API for fsconfig system call
  • 7ff74af unix: drop go version tags for unsupported versions
  • 6b4eab5 unix: suppress ENOMEM errors from sysctl's implementing Uname(uname *Utsname)...
  • 2f2cc5d unix: update IFLA and NETKIT constants with Linux kernel 6.7
  • 914b96c windows: support ill-formed UTF-16 in UTF16PtrToString
  • 511ec84 Revert "windows: support nil done parameter in ReadFile and WriteFile"
  • 628365d windows: support nil done parameter in ReadFile and WriteFile
  • bef1bd8 unix: move mksyscall regexp to package level variables
  • 5710a32 unix/linux: update Linux kernel to 6.7
  • b3ce6a3 windows: build env_windows_test.go only go Go 1.21 and above
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Mar 7, 2024

Bumps golang.org/x/crypto from 0.0.0-20220507011949-2cf3adece122 to 0.21.0.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Mar 7, 2024
Mar 1, 2024
Feb 27, 2024

When mining a block with transactions:

  • contract formation
  • contract revision (broadcast)
  • contract revision (broadcast)
  • contract revision (broadcast)

I noticed my subscriber receives only 3 file contract elements in the ApplyUpdate, more importantly though one of those did not have a revision. I think there's a bug in reviseFileContractElement that doesn't properly update the rev map when encountering an fce we find in ephemeral, which I assume is a sort of cache.

Feb 23, 2024

A mysterious force of nature inspired me to write this code today, thereby increasing the code coverage to 75.7%

Feb 8, 2024
Jan 30, 2024

The current encoding of Currency uses an 8-byte length prefix followed by a variable-length big-endian encoding of the integer. This is inherently wasteful, as currency values never require more than a 1-byte prefix. Variable-length encodings can also hurt performance in certain use cases, and make it harder to predict the real-world size of various encoded payloads.

This PR adds an alternative fixed-width (16-byte) little-endian encoding for Currency. This matches the actual struct definition of Currency in core: two uint64s. Surprisingly, this is not quite as efficient as simply reducing the 8-byte prefix to a 1-byte prefix; the currency values currently present in the blockchain would encode to between 11-15 bytes on average. Still, the advantages of fixed width outweigh the slightly larger size imo.

As a side effect, I also ended up changing the encoding of SiafundOutput to be more compact in v2.

Jan 16, 2024
Dec 11, 2023

We ran into bugs related to determining the right amount of collateral when renewing contracts. Most notably exceeding the max collateral setting of hosts.

There were multiple reasons for that. I was able to get rid of most errors by postponing computing the collateral until after we have acquired a contract.

The other issue, which is the reason for this PR, is the fact that we used ContractRenewalCollateral to compute the newCollateral and then CalculateHostPayouts to create the payouts and both of these functions perform the same math but slightly different. (one uses fc.EndHeight() and the other one fc.WindowEnd` for determining the extension of the renewal).

Since we don't use rhpv2 renewals I'm not going to bother refactoring that but I'm updating rhpv3 to make sure there is no duplicate code anymore and that everything, including the capping of the collateral according to the host's MaxCollateral happens in one place.

Right now this is deployed on Arequipa and there are no more collateral errors.

Dec 9, 2023

I have been adding this to our repos so we can do things like check struct tags automatically. I know core is still changing so if this is unwanted right now please feel free to close this PR.

Edit: Need to do some Ledger review fixes today. Will fix remaining warnings tomorrow.

Dec 8, 2023

I noticed renewal failures in our logs that indicate we're not properly respecting the host's MaxCollateral setting.

{"level":"error","date":"2023-12-07T16:56:27Z","component":"autopilot.contractor","msg":"renewal failed, err: couldn't renew contract: RPCRenew: failed to read RPCRenewContractHostAdditions: ReadResponse: failed to validate renewal: collateral exceeds maximum: expected at most 10000000000000000000000000000 got 10000047475326975980269993984\n","hk":"ed25519:c4b451fa7ab7085763119aeb1aa34db524c5dc6416dc77c5ba82100eb9687790","fcid":"fcid:5a32d8bbfb7e6a29f874ad2ded500d46e3e9aa4675db624b7f782b7fd7f45e05"}
Nov 3, 2023

I finished working on these tests last weekend, but due to unforeseen circumstances, I couldn't submit the pull request. Today I can finally do it, but I noticed that just yesterday another contributor, who coincidentally worked on some of the same test features as I did, submitted his PR #132

I wasn't sure how to proceed in this situation, so I decided to run test coverage. In my case, the overall coverage percentage was 77.3%, while @chris124567's was 79.8%, which I congratulate him on. However, if we combine our PRs, the rate reaches 80.1%

Chris and I approached the task and code-writing differently, and to be honest, I'm not sure how you'll handle our PRs after comparing and analyzing them; nonetheless, I decided to offer alternative tests for the Marshaler and Unmarshaler functions and submit this PR.

Nov 3, 2023

Refers #130

Nov 3, 2023

Get consensus coverage up to 79.8%

Oct 16, 2023

This is a slightly bigger change, so I figured I'd PR it to allow for some discussion instead of just pushing it.

Sia computes a lot of hashes. When I started implementing v2, I took care to make hashing as fast as possible. In particular, I wanted hashing operations to be zero-alloc. That meant accepting some ugliness like hasherPool and eschewing helper functions that might not be inlined.

This PR essentially reverses that decision. Instead of every ID function grabbing a hasher and directly calling EncodeTo on all the stuff we want to encode, we now pass those things to a magic hashAll helper function. The resulting code is definitely more readable; you can see at a glance exactly what's being hashed. The downside is that all of our hashes now allocate, making them a bit slower. How much slower? Anywhere from 1% to 15%, depending on how little data is being hashed. Is that acceptable? Well, when I run our test suite 100x, it takes basically the same amount of time -- definitely nowhere near 15% slower. Regardless -- preventable allocations make me sad. At least ~all of our hashing will be performed inside hashAll now, which means CPU profiles will show us how much time we spend hashing in general...?

Another consequence is that the exact data we're hashing has changed slightly. Basically, instead of omitting signatures, we now hash empty signatures. Why? Because it means instead of writing this:

func (s State) ContractSigHash(fc types.V2FileContract) types.Hash256 {
	return hashAll(
		"sig/filecontract",
		s.v2ReplayPrefix(),
		fc.Filesize,
		fc.FileMerkleRoot,
		fc.ProofHeight,
		fc.ExpirationHeight,
		fc.RenterOutput,
		fc.HostOutput,
		fc.MissedHostValue,
		fc.RenterPublicKey,
		fc.HostPublicKey,
		fc.RevisionNumber,
	)
}

we can write this:

func (s State) ContractSigHash(fc types.V2FileContract) types.Hash256 {
	fc.RenterSignature, fc.HostSignature = types.Signature{}, types.Signature{}
	return hashAll("sig/filecontract", s.v2ReplayPrefix(), fc)
}

Having a helper like hashAll doesn't force us to make this change, but it sure makes it a lot more compelling, doesn't it?

Lemme know if you have strong feelings about this either way. Frankly, I'm pretty confident that this is the right choice; writing a big post about it is probably just my way of coping with the loss of my precious zero-alloc code 😭

Oct 11, 2023

I was working around this in both renterd and hostd but it's easier to update it here instead.

Oct 2, 2023

Fixes the node12 deprecation warning