-
Notifications
You must be signed in to change notification settings - Fork 93
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
Support new Lotus API + calibration network #529
Conversation
aa15e7d
to
d5c4adf
Compare
d93c590
to
1077b6b
Compare
20c333b
to
c72b696
Compare
d412b0d
to
9030d80
Compare
9030d80
to
d85379e
Compare
cb64afc
to
76252c6
Compare
7a12351
to
76430af
Compare
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
ca8d3d8
to
bfa79fc
Compare
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
bfa79fc
to
49a9acb
Compare
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
DealMinDuration: 1000, | ||
DealMinDuration: util.MinDealDuration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now min deal duration isn't arbitrary for Filecoin, so it's a constant.
if minDuration < util.MinDealDuration { | ||
return nil, fmt.Errorf("duration %d should be greater or equal to %d", minDuration, util.MinDealDuration) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early check that the duration is >= the minimum defined by spec. If it isn't, fail fast.
@@ -116,7 +119,8 @@ func (m *Module) Store(ctx context.Context, waddr string, dataCid cid.Cid, piece | |||
} | |||
params := &api.StartDealParams{ | |||
Data: &storagemarket.DataRef{ | |||
Root: dataCid, | |||
TransferType: storagemarket.TTGraphsync, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary to have deals working in new Lotus version.
require.NoError(t, err) | ||
require.Len(t, final, nm) | ||
t.Parallel() | ||
tests.RunFlaky(t, func(t *tests.FlakyT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests.RunFlaky
is a helper that runs a tests and consider that fails if fails 5 times in a row.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
@@ -0,0 +1,279 @@ | |||
package config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration tests got partitioned in their own packages. This to allow if some test fail, only invalidate a subset of them in the test cache. This was more relevant before I did the tests.RunFlaky
thing, but I kept this change since provides also better organization; the integration test file was very big.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,65 @@ | |||
package tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FlakyT
helper I created to provide some retry at the integration test level.
Might be useful in other projects.
// LaunchDevnetDocker launches the devnet docker image. | ||
func LaunchDevnetDocker(t *testing.T, numMiners int, ipfsMaddr string, mountVolumes bool) *dockertest.Resource { | ||
func LaunchDevnetDocker(t TestingTWithCleanup, numMiners int, ipfsMaddr string, mountVolumes bool) *dockertest.Resource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This *testing.T
to TestinTWithCleanup
replacement happened in some places.
*testing.T
is a concrete type, and we want LaunchDevnetDocker
to work with *testing.T
but also work with our "FlakyT" runner. If things would still use *testing.T
and call Fail()
that would mess up retries.
TestingTWithCleanup
has the same interface as *testing.T
so the user shouldn't be worried about anything extra. Just do whatever usually would do, and FlakyT
will do whatever it needs.
if err != nil { | ||
panic(fmt.Sprintf("couldn't create ipfs-pool: %s", err)) | ||
} | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestingTWithCleanup
is compatible with require
, so can be used as "nothing happened".
From: m.masterAddr, | ||
To: addr, | ||
Value: types.BigInt{Int: m.iAmount}, | ||
GasLimit: 1000, | ||
GasPrice: types.NewInt(0), | ||
From: m.masterAddr, | ||
To: addr, | ||
Value: types.BigInt{Int: m.iAmount}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot happened here while tracking different releases of Lotus code.
To make the story short: this way the Lotus node will decide the most reasonable Gas price considering recent history of gas prices.
@@ -1,19 +1,10 @@ | |||
COMPAT_MSG="The current version of Powergate support newer versions than Testnet network. You might be interested in using the Calibration network (make calibration-up)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some message that gets printed if make up
is executed. Will eventually go away when Testnet resets to latest code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of changes, but it all makes sense. Probably the crazier changes were in the other repos we depend on here. Nice work.
require.NoError(t, err) | ||
require.Len(t, final, nm) | ||
t.Parallel() | ||
tests.RunFlaky(t, func(t *tests.FlakyT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
@@ -0,0 +1,279 @@ | |||
package config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
You can be totally sure about that 😅 |
This PR targets the
ntwk-calibration
Lotus branch, which is a newer codebase with breaking APIs, this means it can't coexist supportingtestnet
nor currentnerpa
.ntwk-calibration
code will be the nextnerpa
network.The command
make up
now prints a message saying that current Testnet isn't supported since is still running a Lotus version with old broken APIs. Whenever is updated we can re-enable that. The message suggests runningmake nerpa-up
so to help the user connect to some network.Apart from changes in this repo, there were many changes in others. In particular, upgrading
textileio/lotus-devnet
andtextileio/lotus-build
. In the process of upgradinglotus-devnet
which is a pillar of the CI, we've discovered multiple bugs which ended up being resolved: e.g: here, here, and here.Considering that
lotus@master
is still targetingtestnet
, I madetextileio/lotus-devnet
have multiple branches per network. So, the newest one which Powergate is using now islotus-devnet@ntwk-calibration
which is thelocalnet
running the latest code oflotus
. Whenevermaster
has the latest code, we might abandon that branch.While updating Powergate to the latest Lotus APIs, I took advantage and did other changes:
sector-storage
. For more info see this and the mentioned PR there. I guess eventually that would be totally fixed. Not much to do now.