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

Restructure directory for clarity #12

Merged
merged 6 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: CI
on:
pull_request:
paths:
contract/Xorshift128plus.cdc
- contract/Xorshift128plus.cdc
- prg_test.go
- prg_test_helpers.go

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion contracts/CoinToss.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ access(all) contract CoinToss {
let receiptID = receipt.uuid

// self.randomCoin() errors if commitBlock <= current block height in call to
// RandomBeaconHistory.sourceOfRandomness()
// RandomBeaconHistory.sourceOfRandomness()
let coin = self.randomCoin(atBlockHeight: receipt.commitBlock, salt: receipt.uuid)

destroy receipt
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@
}
},
"FlowToken": {
"source": "./contracts/utility/FlowToken.cdc",
"source": "./contracts/standard/FlowToken.cdc",
"aliases": {
"emulator": "0ae53cb6e3f42a79",
"mainnet": "1654653399040a61",
"testnet": "7e60df042a9c0868"
}
},
"FungibleToken": {
"source": "./contracts/utility/FungibleToken.cdc",
"source": "./contracts/standard/FungibleToken.cdc",
"aliases": {
"emulator": "ee82856bf20e2aa6",
"mainnet": "f233dcee88fe0abe",
"testnet": "9a0766d93b6608b7"
}
},
"MetadataViews": {
"source": "./contracts/utility/MetadataViews.cdc",
"source": "./contracts/standard/MetadataViews.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"mainnet": "1d7e57aa55817448",
"testnet": "631e88ae7f1d7c20"
}
},
"NonFungibleToken": {
"source": "./contracts/utility/NonFungibleToken.cdc",
"source": "./contracts/standard/NonFungibleToken.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"mainnet": "1d7e57aa55817448",
"testnet": "631e88ae7f1d7c20"
}
},
"RandomBeaconHistory": {
"source": "./contracts/RandomBeaconHistory.cdc",
"source": "./contracts/standard/RandomBeaconHistory.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"mainnet": "e467b9dd11fa00df",
"testnet": "8c5303eaa26202d6"
}
},
"RandomResultStorage": "./contracts/utility/RandomResultStorage.cdc",
"RandomResultStorage": "./contracts/test/RandomResultStorage.cdc",
"ViewResolver": {
"source": "./contracts/utility/ViewResolver.cdc",
"source": "./contracts/standard/ViewResolver.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"mainnet": "1d7e57aa55817448",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.19

require (
github.com/bjartek/overflow v1.14.1
github.com/onflow/cadence v0.42.2
github.com/onflow/flow-go/crypto v0.24.10
github.com/stretchr/testify v1.8.4
)
Expand Down Expand Up @@ -108,6 +107,7 @@ require (
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/nightlyone/lockfile v1.0.0 // indirect
github.com/onflow/atree v0.6.0 // indirect
github.com/onflow/cadence v0.42.2 // indirect
github.com/onflow/flow-cli/flowkit v1.4.5 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230703193002-53362441b57d // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.3 // indirect
Expand Down
14 changes: 7 additions & 7 deletions prg_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func GetNextUInt64NewPRGWithSalt(

var value uint64
err := o.Script(
"xorshift128plus/next_uint64",
"test/next_uint64",
WithArg("sourceOfRandomness", seed),
WithArg("salt", salt),
).MarshalAs(value)
).MarshalAs(&value)

require.NoError(t, err)

Expand All @@ -54,7 +54,7 @@ func GetResultsFromRandomResultStorage(
) []uint64 {
t.Helper()
var uint64Array []uint64
err := o.Script("random-result-storage/get_results").MarshalAs(uint64Array)
err := o.Script("test/get_results").MarshalAs(&uint64Array)
require.NoError(t, err)
return uint64Array
}
Expand All @@ -70,10 +70,10 @@ func GetResultsInRangeFromRandomResultStorage(

var uint64Array []uint64
err := o.Script(
"random-result-storage/get_results_in_range",
"test/get_results_in_range",
WithArg("from", from),
WithArg("upTo", upTo),
).MarshalAs(uint64Array)
).MarshalAs(&uint64Array)
require.NoError(t, err)

return uint64Array
Expand All @@ -89,7 +89,7 @@ func GenerateResultsAndStore(
) {
t.Helper()
o.Tx(
"random-result-storage/generate_results",
"test/generate_results",
WithSignerServiceAccount(),
WithArg("generationLength", length),
).AssertSuccess(t)
Expand All @@ -104,7 +104,7 @@ func InitializePRG(
) {
t.Helper()
o.Tx(
"random-result-storage/initialize_prg",
"test/initialize_prg",
WithSignerServiceAccount(),
WithArg("sourceOfRandomness", seed),
WithArg("salt", salt),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "Xorshift128plus"
///
/// Note that if the PRG were stored onchain, this script would not advance the state of the PRG
///
pub fun main(sourceOfRandomness: [UInt8], salt: [UInt8]): UInt64 {
access(all) fun main(sourceOfRandomness: [UInt8], salt: [UInt8]): UInt64 {
return Xorshift128plus.PRG(sourceOfRandomness: sourceOfRandomness, salt: salt).nextUInt64()
}
25 changes: 0 additions & 25 deletions scripts/xorshift128plus/get_array_next_uint64.cdc

This file was deleted.

29 changes: 0 additions & 29 deletions transactions/xorshift128plus/iterative_next_uint64.cdc

This file was deleted.

Loading